Jump to content

Template help!


Scoobs
 Share

Recommended Posts

I'm trying to set up a database where users can upload an image and that image would preview on the categories page.  However, if the user choses to not upload an image, I would like to display a default image in it's place.  I assume I would need some sort of "if" statement in the page template, right?

On the display options tab for the image upload field it says : The field key can be used in HTML templates to fetch a specific field, for instance: {$record->customFieldDisplayByKey('my_key', 'listing')|raw} and my template key is "image_1"

So I'm assume I would need to include something similar to below but I don't know how to check to see if an image has been uploaded.  Any help?

{{if $record->customFieldDisplayByKey('image_1','listing')|raw}}
              <img src="http://defaultimage.jpeg" class="defaultImage">
          {{endif}}

 

Thanks

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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