First up, the code for the menu template:
Code: Select all
<ul>
{foreach from=$nodelist item=node name=recursive_menu}
{* The first time around, we should display everything, all the other time
we should ignore the first element since we should have already displayed
it.
*}
{if !isset($tmp_starting_recursion) || !$smarty.foreach.recursive_menu.first}
<li>
{cms_selflink page=$node->alias}
{if $node->haschildren}
{* Let future calls know that the recursion has begun so that it
would skip displaying the first item.
*}
{assign var=tmp_starting_recursion value=true}
{* This will display all menu items that is the children of the
current alias including that alias (that is why we need to skip
displaying it with the first if statement). Try to keep everything
the same here except the templat name which should be the same
name of the template you are currently editing.
*}
{menu start_page=$node->alias number_of_levels=2 template='Recursive'}
{/if}
</li>
{/if}
{/foreach}
</ul>
Code: Select all
{* Reset the temp variable so we can call this recursive menu more than once. No need
for this if we are only calling the menu once.
*}
{assign var=tmp_starting_recursion value=false}
{* Call the menu with only the first level as the menu will take care of all the
lower elements.
*}
{menu template='Recursive' num_of_levels=1}