
anyway
the question as have been asked many times before is this
I have the menu like this
1
2
2.1
2.2
2.2.1
2.2.2
2.3
3
3.1
4
4.1
4.2
top menu is set to display only top menu
{menu template='Top' number_of_levels='1'}
submenu like this
{menu template='Sub' show_root_siblings='0' collapse='1' start_level='2'}
submenu is like this
Fler val
{foreach from=$nodelist item=node}
url}">{$node->menutext}
{/foreach}
Now.. you who understand this system better than me will probobly see what is wrong..
What I want is this
I click on menu 2
sub menu now display 2.1 and 2.2
if I click on 2.2, then sub menu display 2.2.1 and 2.2.2
but now it displays every sub menu under the top level..
so.. clicking on 2 or 2.1. or 2.2 or 2.2.1 or 2.2.2 always display 2.1, 2.2
how to I make it start on the current level and only display one step below?
[SOLUTION]
menutemplate for submenu
Code: Select all
{foreach from=$nodelist item=node}
{if $node->current==true}
{assign var="depth" value=$node->depth}
{/if}
{/foreach}
{foreach from=$nodelist item=node}
{if $node->depth==$depth+1}
{assign var="hassub" value=1}
{/if}
{/foreach}
{if $hassub==1 }
<li id="submeny">
<h2>Fler val</h2>
<ul>
{foreach from=$nodelist item=node}
{if $node->depth==$depth+1}
<li><a href="{$node->url}">{$node->menutext}</a></li>
{/if}
{/foreach}
</ul>
</li>
{/if}
look at all menues until current menu is found.
set that menues depth
look at all menues matching that depth
count number of menus to know if this should be displayed or not
Display menu in template
Code: Select all
{menu template='Sub' show_root_siblings='0' collapse='1' start_level='1'}