Page 1 of 1

Multiple Menus

Posted: Tue Nov 28, 2006 6:40 pm
by mnapiork
I'm new to CMSMS and I was wondering if it is possible to create multiple menus?  I want to use the default left menu and I also want to add a horizontal menu to the header of my page.  Is this possible?

Re: Multiple Menus

Posted: Tue Nov 28, 2006 6:57 pm
by pishkus
yes  it is.
you can use as many menu calls {menu} as you wish.

Re: Multiple Menus

Posted: Tue Nov 28, 2006 8:02 pm
by mnapiork
How does the tag differentiate between the different menus?

Re: Multiple Menus

Posted: Tue Nov 28, 2006 8:57 pm
by pishkus
it doesn't.
Maybe you should try using different tpl files. You can find all the information you need in the 'Menu Manager' module (Extensions->Modules) 'Help' section.

Re: Multiple Menus

Posted: Tue Nov 28, 2006 11:30 pm
by mnapiork
I read the help section and they give info on creating menus, but I didn't see anything on my specific problem.

Let me clarify...
I have two menus:

Menu 1 is in the left column of the page.

Menu 1
  • Menu 1 Link 1
  • Menu 1 Link 2
  • Menu 1 Link 3
Menu 2 is in the header of the page.

Menu 2
  • Menu 2 Link 1
  • Menu 2 Link 2
  • Menu 2 Link 3
Currently my Menu 1 appears in the left column of the page.  Now how do I create a separate second menu for the header of the page?

Re: Multiple Menus

Posted: Tue Dec 05, 2006 10:06 pm
by KO
Yes this can be done with CMSMS. I was just looking how to do this with previous work and it was more simple than I ever thought.

Just put the menu tag in your layout where you want it. If you want one in header put it there and tell it what kind of template it should use. Also tell what is the start page. It might look something like this {cms_module module='menumanager' template='template_name' start_page="Menu 2" }

You might want to make "Menu 2" as content page or section header and other pages in that menu are parent of it. Then you set it not visible in Menu from it's page settings and also add {start_level='2'} inside that menu tag.
{cms_module module='menumanager' template='template_name' start_page="Menu 2" start_level='2' }
Then menu links start from second level and "Menu 2" itself is not visible anywhere.
Ofcourse you can combine different kind of navigation by selecting right template.
Maybe I'm missing something here but unfortunately I have all the files at work. Othervice very very simple when you done it once.

Have fun,

K

Re: Multiple Menus

Posted: Wed Dec 06, 2006 3:04 am
by mnapiork
Works perfectly!!!  Thanks!

Re: Multiple Menus

Posted: Mon Mar 12, 2007 2:13 pm
by lone
I have tried this solution - works fine, is easy to set up.
It does not validate, however, as you get incoorect nesting of the two ul´s.
Too bad.

Re: Multiple Menus

Posted: Mon Mar 12, 2007 4:51 pm
by KO
I've noticed this too. But if you make copy from your menu template with different name and call that one then you have no problems with validation.

Br,
Keijo

Re: Multiple Menus

Posted: Tue Mar 13, 2007 7:32 am
by moonie
I'm trying to achieve the same splitted navigation (First level on top of the layout, second level at the left side), but using the header link to child menu template. In this case, the first hierarchy consists of Section Headers that automatically link to their respective child.

The menu itself works a charm when you output it in one piece. But as soon as I split it and load the first bit of my navigation with number_of_levels="1",  the Section Headers don't work properly anymore. Could it be that a Section Header isn't really considered a level, or would the chosen template need some adaptions to make it work for my case?

Re: Multiple Menus

Posted: Tue Mar 13, 2007 8:52 am
by KO
Never tried that template so no experience.
What you could also try is to make first level not as section header but a link to a second level page.

K

Re: Multiple Menus

Posted: Tue Mar 13, 2007 9:30 am
by moonie
Thanks for the input, KO! Since it urges with deadlines, I think I will do it the way you suggested (and explain the client that if he moves around submenu order, he should change the parentmenu link accordingly  ;D) rather than spending too much time adapting the template.

Re: Multiple Menus

Posted: Wed Mar 14, 2007 10:27 am
by Vin
I've run into this problem as well, moonie, and little tweaked the header_to_link template. Here is my menu template for the top navigation:

Code: Select all

{* CSS classes used in this template:
#active - The active/current page
.sectionheader - To style section header
hr.separator - To style the ruler for the separator *}
{if $count > 0}
<ul>
{foreach from=$nodelist item=node}
{if $doheaderlink == "1"}
{assign var="doheaderlink" value="0"}
<li class="sectionheader"><a href="{if $node->titleattribute == 'home'}/{else}{$node->url}{/if}">{$headertext}</a>
{/if}
{if $node->depth == 1}
{if $node->index > 0}
</li>
{/if}
{if $node->current == true}
<li id="active"><a href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}>{$node->menutext}</a>
{elseif $node->type == 'sectionheader'}
{assign var="doheaderlink" value="1"}
{assign var="headertext" value=$node->menutext}
{elseif $node->type == 'separator'}
<li id="separator">
{else}
<li><a href="{if $node->titleattribute=='home'}/{else}{$node->url}{/if}"{if $node->target ne ""} target="{$node->target}"{/if}>{$node->menutext}</a>
{/if}
{/if}
{/foreach}
</li>
</ul>
{/if}
You may have noticed that I use $node->titleattribute=='home' in template. This is just for the link to home/main page of the site to look like www.site.com, not like www.site.com/nav1link/nav2link, you can omit that condition if you want. Ensure you've inserted the menu tag like this:

Code: Select all

{menu template="top_navigation" start_level="1" [b]number_of_levels="2"[/b]}
and that it fits into your template (for instance, in the shared menu templates on the CMSMS site there are some with div class="menu", some without them).
Elijah Lofgren also wrote a solution for this kind of menu here (however, I have the feeling it wasn't available that time for me): http://wiki.cmsmadesimple.org/index.php/User_Handbook/Admin_Panel/Layout/Menu_Manager#header_link_to_child_dont_show_children