Forums / Setup & design / The switch function. Can't manage to print correctly the different cases.

The switch function. Can't manage to print correctly the different cases.

Author Message

laurent le cadet

Thursday 02 October 2003 8:45:48 am

Hi,

I'm trying to understand how the switch function works.

I have writen this :

{switch name=Sw match=$node.data_map.tit_graph}
{case match="<p></p>"}
 
{/case}
{case match=""}
 
{/case}
{case}
<h4>{attribute_view_gui attribute=$content_version.data_map.tit_graph}</h4>
{/case}
{/switch}

but it don't seems to be ok... :-(

What I want is to print the content of an item of the data_map (tit_graph) in my <h4> style but even if the text field or xml field in my classe is empty (case <p></p> or "") it print an empty <h4> style.

Normally it should be empty, isn't it ?

Laurent

Alex Jones

Thursday 02 October 2003 10:06:18 am

Perhaps try using $node.data_map.tit_graph.content or perhaps $node.data_map.tit_graph.output If nothing else, I would recommend looking at the attributes to see what you should be trying to match: {$node|attributes(show)}

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

laurent le cadet

Thursday 02 October 2003 10:33:01 am

Thanks Alex,

$node.data_map.tit_graph.content

works fine.

Laurent.