Share » Forums » Setup & design » Display grandchildren/subheadings on...

Display grandchildren/subheadings on page

Display grandchildren/subheadings on page

Thursday 19 October 2006 6:11:32 pm - 1 reply

Author Message

Claudia Kosny

Friday 20 October 2006 3:43:32 am

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 *}

<h1>{$node.data_map.name.content|wash()}</h1>

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

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

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

Greetings from Luxembourg

Claudia

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

36 542 Users on board!

Forums menu