We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Conditional Tag to Display Images from Grid field

How Do I?

restos's avatar
restos
54 posts
10 years ago
restos's avatar restos

Hi,

I have one grid field with a maximum of 4 rows, every row is a file to allow editors to upload from 1 to 4 images.

The first image is required and others are optional.

First image: main_image

Optional images:

additional_image_1 additional_image_2 additional_image_3 additional_image_4

To display the required image in template i use this tag:

{product_images:main_image}

To display additional images i want to use a conditional tag in template. I’ve tried with:

{if product_images:additional_image_1} <img > {/if}

It doesn’t work. Anybody can give me directions of how code should be?

Thank you.

       
Jeremy S.'s avatar
Jeremy S.
353 posts
10 years ago
Jeremy S.'s avatar Jeremy S.

With grid you would be outputting your images in a loop, so ee will only display whatever is stored, whether it’s 1 or all 5 images. Review these docs, if you haven’t yet: https://ellislab.com/expressionengine/user-guide/fieldtypes/grid.html

If you mean something else, post back with more of your template code.

       
restos's avatar
restos
54 posts
10 years ago
restos's avatar restos

Thanks you

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.