This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Setup & design » Display grandchildren/subheadings on...

Display grandchildren/subheadings on page

Display grandchildren/subheadings on page

Friday 20 October 2006 3:11:32 am - 1 reply

How would I go about displaying a node so that the node's grandchildren are displayed in addition to its children?

For example, I want a page that looks like:

Rather than:


Where 'Food I Like' is the parent; 'Fruit', 'Vegetables', and 'Sweets' are the children; and the bullets are the grandchildren. (I really don't care how the tree looks, I just care that the final output works, and is updated dynamically.)

I know that I can do this by 'not showing contents', and linking the contents manually in the description field, but this solution is less than optimal.

Would I do this in templates, or elsewhere? Any suggestions?

Friday 20 October 2006 12:43:32 pm

Hi David

Just change the full view template for the folder and for each child add an additional fetch for the children of this child.

Very basic template:

{* $node contains the node of the folder you are currently viewing *}
{* display name and description *}


{if $node.data_map.short_description.content.is_empty|not}
 <div class="attribute-short">
  {attribute_view_gui attribute=$node.data_map.short_description}
{if $node.data_map.description.content.is_empty|not}
 <div class="attribute-long">
  {attribute_view_gui attribute=$node.data_map.description}

{* fetch the direct children *}
{def $children = fetch('content', 'list', hash('parent_node_id', $node.node_id,
                                                            'sort_by', $node.sort_array))}
{if $children}
 {foreach $children as $child}
 <li><a href={$child.url_alias|ezurl()}>{$|wash}</a>
 {* now fetch the children of this child *}
 {def $grandchildren =  fetch('content', 'list', hash('parent_node_id', $child.node_id,
                                                                      'sort_by', $child.sort_array))}
 {if $grandchildren}
  {foreach $grandchildren as $grandchild}
   <li><a href={$grandchild.url_alias|ezurl()}>{$|wash} </a></li>
 {undef $grandchildren}

Health warning: This code may contain typos and other errors.

Greetings from Luxembourg


Modified on Friday 20 October 2006 12:45:28 pm by Claudia Kosny


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from