Wednesday 10 March 2004 6:57:15 am
Yes, it is possible, and there is probably more than one way to do it. Pretty much what you will want to do is write a section tag that checks to see if your content is empty or not. If it is empty then you do a fetch against the parent node and display it's content. Here is some code (untested, you may need to tweak):
{section show=ne($:item.data_map.body,'')} {* check to see if the body is _not_ empty *}
{attribute_view_gui attribute=$:item.data_map.body}
{section-else} {* body is empty so grab content from the parent *}
{let name=Child children=fetch('content','list',hash(parent_node_id,$node.parent_node_id,))}
{attribute_view_gui attribute=$:item.data_map.body}
{/let}
{/section}
If nothing else, you would do well to look at the attributes available to you by adding <i>{$node|attribute(show)}</i> to the template, which will provide you a table of the information that applies to that object. From there you can easily figure out what to use in your template to display the attribute in question. From the documentation (http://ez.no/ez_publish/documentation/development/libraries/ez_template/operators/miscellaneous):
<b>attribute</b> Helper attribute to print available methods in objects and arrays, by default it only shows the array keys and object attribute names but by passing show as parameter it will fetch the values. The second parameter can be used to controlled the number of children to expand, default is no limit which may give problems with values that loop. The returned result is an HTML table unless false() is passed as the third parameter. E.g. {$node|attribute(show)}, {$node|attribute(show,2,false)}
Hope this helps. Alex
Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]
<i>When in doubt, clear the cache.</i>
|