Jump to content

Recommended Posts

Posted

Hi guys... I love pw!

I'm trying to update a template of the multilanguagge website. I created a field, i called it "headimage" and I added it to the home template. .. . But I can t see any image!!! Where is the issue??

Thanks

my friends

 

  • Like 1
Posted
1 hour ago, angelo, italy said:

But I can t see any image!!!

Did you also adjust the template's PHP code to generate markup for your image? Something like:

echo "<img src='{$page->headimage->url}'/>";

 

Posted

Hi!

I did it, my code is

<img class="img-responsive"   src="<?php echo $page->headimage->url?>" />

but imags don't appear!

If I analyze code in the front using google console I saw this code

<img class="img-responsive" src="/processwire-master/site/assets/files/1/">

.. it seems to stop in the folder without getting image's url..

 

?

Schermata 2019-04-16 alle 09.40.43.png

Schermata 2019-04-16 alle 09.40.58.png

Posted

Is this field set up to only accept one image or multiple? And what did you define in the output settings? (single image or multiple, string or array)

8 hours ago, angelo, italy said:

<img class="img-responsive"   src="<?php echo $page->headimage->url?>" />

 

You would use this if you only allow one single image.

But in your screenshot I see multiple images.

In that case, you would rather use something like $page->headimage->first()->url to get the first image only.

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...