{if $smarty.request.parent} {init_objects name="roots" parent=$smarty.request.parent|@intval classes=$smarty.request.show|default:"section"} {else} {init_objects name="roots" parent_system_alias="home" classes=$smarty.request.show|default:"section"} {/if} {assign var="tree" value=$roots|@array_reverse} {foreach from=$tree item="tree_item"} {$tree_levels|@array_push:0} {/foreach} {assign var="loop_control" value=true} {if sizeof($tree)} {strip} {/section} {/if} {* close the node print out if there is no children for this node *} {if !sizeof($children)} {/if} {* put the children into the tree for travelling + their level *} {foreach from=$children item="child"} {$tree|@array_push:$child} {$tree_levels|@array_push:$node_level+1} {/foreach} {* close the while loop if there is no more nodes to travel *} {if sizeof($tree) == 0} {assign var="loop_control" value=false} {/if} {/while} {* close the list *} {/strip} {/if}{* sizeof($tree) *}