Jump to content

Recommended Posts

Posted

Hi, in my template there is a small image that I would like to change from time to time.
I created an image field, but it doesn't work. I have used the following code:

<img src="<?=$page->my_image_field?>" alt="">

How come it is not working?

Posted
<img src="<?= $page->my_image_field->url ?>" alt="<?= $page->my_image_field->description ?>"> // never forget to add "alt" attribute here

In your example the "url" property was missing.

Posted

I replaced the code but it doesn't work. Maybe I have to write just the whole url as the address?

<img src="<?=$page->note_MDL_my_image_field->url?>" alt="then I change it">

or

<img src="<?=$page->note_MDL_my_image_field->urlimageaddress?>" alt="then I change it">

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...