Forums / Setup & design / If exist
Daniele Cacace
Tuesday 13 September 2005 3:36:22 am
I have a class with a object called IM (it is a image). In template i want:If exist a IM than insert IM else insert standard IM
???
TNX!
Nabil Alimi
Tuesday 13 September 2005 3:53:47 am
Hi,
Use the <b>has_content</b> attribute.
{if $node.object.data_map.IM.has_content} {attribute_view_gui=$node.object.data_map.IM} {else} <i>Your standard image</i>{/if}
My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com eZ Publish Freelance developper. Feel free to contact me +33 674 367 057 nabil at assiki d0t fr
Tuesday 13 September 2005 5:18:36 am
The has_content attribute does not work in a cycle
Tuesday 13 September 2005 5:41:01 am
What do you call "cycle" ?
Tuesday 13 September 2005 5:47:26 am
{section loop=fetch( content, list, hash( parent_node_id, $node.node_id, offset, $view_parameters.offset, sort_by, $node.sort_array, limit, 8) ) }
. . . ..
Tuesday 13 September 2005 6:07:13 am
Well a loop... :)
Of course it can work but you need to apply the right syntax.
I recommend to use the <b>foreach</b> statement instead of <b>section loop</b> but it works also with section loop.
You can do this for example : {section <b>var=test</b> loop=fetch( content, list, hash( parent_node_id, $node.node_id, offset, $view_parameters.offset, sort_by, $node.sort_array,limit, 8) ) }
<i>And here you apply the test</i>
{if $test.data_map.IM.has_content} {attribute_view_gui=$test.data_map.IM} {else} Your standard image{/if}
{/section}
Something like this sould work.