Thursday 28 August 2003 7:53:31 am
No problem, we're all in the same boat! I've had a ton of help from other developers. :) I'm not sure why the code I provided didn't work. Is your header text or an image? Also, have you tried looking at the attributes of the header? It might help you get an idea of what information you can detect for your show statement. Try: {$:item.data_map.header|attribute(show)} or {$:item.data_map|attribute(show)} Here is some code that I am actually using in my templates to choose between possible images:
{section show=eq($:item.data_map.image,'')}
{attribute_view_gui attribute=$:item.data_map.image_1 image_class=proportionalmedium}
{section-else}
{attribute_view_gui attribute=$:item.data_map.image image_class=proportionalmedium} {/section} This code is detecting which image is available to display. I need the check as I am fetching several different types of class, one of which has multiple images (thus the 'image_1') while most only have a single image (thus just 'image'). So, I detect whether or not a field of 'image' contains any data. If it doesn't exist, or if it is empty it returns nothing and thus matches the show statement (specifically the '') so I display 'image_'1. The section-else displays 'image'. Note: 'proportionalmedium' is a custom image class. I hope this helps, Alex
Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]
<i>When in doubt, clear the cache.</i>
|