[solved]simple menu query?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
macko
Forum Members
Forum Members
Posts: 21
Joined: Fri Oct 17, 2008 11:28 pm

[solved]simple menu query?

Post by macko »

duuuhhhhhh i feel silly now as this was easy to do.   i spent all day yesterday trying to figure this out but i couldn't see the wood for the tree menu....

Hi All,

I have a query regarding menus. 
My site has the main nav at the top of the page.  At the side of the page is the sub nav - all good. 

However I want to add children to the sub nav pages and only have these items appear in the menu if the sub nav items are clicked.

Right now when I add a child to my sub menu items this child also appears in the sub menu.  Is there a way to stop the menu showing children of pages until that particular page is clicked?

ie:  sub menu first appears 

sub menu
item 1
item 2
item 3

then when item 2 is clicked I want menu to become...


sub menu
item 1
item 2
   child of item 2
   child of item 2
   child of item 2
item 3

and so on.

I have {menu template='cssmenu.tpl' start_level='2' collapse='1'} in my template.

Many thanks,
Ronan
Last edited by macko on Thu May 21, 2009 7:48 pm, edited 1 time in total.
docman
Forum Members
Forum Members
Posts: 103
Joined: Sat Oct 10, 2009 4:25 pm

Re: [solved]simple menu query?

Post by docman »

Hi, I see this topic has gotten outdated, though it would deserve attention. My attempt is the same, so I hope someone may be able to help us with.
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm
Location: The Netherlands

Re: [solved]simple menu query?

Post by Jos »

For one site I have this menu-template, which you can call just with {menu} when you make this new template default in menu-manager.

Note: it only works if you have pages in two levels.

Code: Select all

{if $count > 0}
<ul class="clearfix">
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="<ul>" times=$node->depth-$node->prevdepth}
{elseif $node->depth < $node->prevdepth}
{repeat string="</li></ul>" times=$node->prevdepth-$node->depth}
</li>
{elseif $node->index > 0}</li>
{/if}

{if $node->current == true}
<li class="currentpage"><a href="{$node->url}" class="currentpage"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext} </a>

{elseif $node->parent == true && $node->depth == 1 and $node->type != 'sectionheader' and $node->type != 'separator'}
<li class="activeparent"> <a href="{$node->url}" class="activeparent"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext} </a>

{elseif $node->type == 'sectionheader'}
<li class="sectionheader">{$node->menutext}

{elseif $node->type == 'separator'}
<li style="list-style-type: none;"> <hr class="separator" />

{else}
<li><a href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext} </a>

{/if}

{/foreach}

{repeat string="</li></ul>" times=$node->depth-1}</li>
</ul>
{/if}
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: [solved]simple menu query?

Post by Dr.CSS »

The answer was in the post...

I have {menu template='cssmenu.tpl' start_level='2' collapse='1'} in my template....

You can use whatever menu template you want...
Post Reply

Return to “CMSMS Core”