Optional content items - how to NOT display in a template?

Author Message

Pirkka Hartikainen

Tuesday 29 July 2003 5:42:11 am

Simple noobie question:

"I have an optional image field in my content class. I know how to display the image on the page using code like this:

<img src=/{$node.data_map.myimage.content[reference].full_path}>

How do I write a conditional statement that only outputs this line if the 'myimage' data item exists for the currently viewed node?"

I've tried this one, unsuccesfully:

{let ImageURL=$node.data_map.myimage.content[reference].full_path}
{section show=not(eq($ImageURL, ""))}
<img src=/{$ImageURL}>
{/section}

Bjørn Kaarstein

Tuesday 29 July 2003 6:47:46 am

Try something like this...

{section show=ne($node.data_map.myimage.content)}

<img src={$node.data_map.myimage.content[medium].full_path|ezurl} hspace="5" vspace="5" border=1 align=left>

{/section}

Regards Bjørn

Pirkka Hartikainen

Tuesday 29 July 2003 2:39:20 pm

Works!!! Thank you.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.