Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Again, a beginners question.

My customer has a list of projects. It comes with a heading, subheading, description & (sometimes) picture.


Therefore I created a repeatable region with 4 variables.

I don't want an image to be shown for every project, because sometimes there is none.

What I did for the image:

<cms:editable type='image' label='solo photo' name='solo_photo' />
<img src="<cms:show solo_photo/>"/>

Of course that code always shows a blank grey field, because the image-tag is always visible. It just doesn't always have a source.

What would be a propper way to show an image only if desired?

Thank you very much.

Greetings,

Pierre
Hi,

The solution would be to first check if an image is available and then output the IMG tag. For example, as follows -
Code: Select all
<cms:if solo_photo >
    <img src="<cms:show solo_photo/>"/>
</cms:if>

Hope it helps.
oh. nice. thanks!
3 posts Page 1 of 1
cron