Multiple Menus

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.
Locked
mnapiork
Forum Members
Forum Members
Posts: 36
Joined: Tue Nov 28, 2006 6:33 pm

Multiple Menus

Post 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?
pishkus

Re: Multiple Menus

Post by pishkus »

yes  it is.
you can use as many menu calls {menu} as you wish.
mnapiork
Forum Members
Forum Members
Posts: 36
Joined: Tue Nov 28, 2006 6:33 pm

Re: Multiple Menus

Post by mnapiork »

How does the tag differentiate between the different menus?
pishkus

Re: Multiple Menus

Post 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.
mnapiork
Forum Members
Forum Members
Posts: 36
Joined: Tue Nov 28, 2006 6:33 pm

Re: Multiple Menus

Post 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?
KO
Power Poster
Power Poster
Posts: 562
Joined: Mon Nov 06, 2006 7:55 pm

Re: Multiple Menus

Post 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
mnapiork
Forum Members
Forum Members
Posts: 36
Joined: Tue Nov 28, 2006 6:33 pm

Re: Multiple Menus

Post by mnapiork »

Works perfectly!!!  Thanks!
lone
Forum Members
Forum Members
Posts: 71
Joined: Mon Feb 27, 2006 1:36 pm

Re: Multiple Menus

Post 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.
KO
Power Poster
Power Poster
Posts: 562
Joined: Mon Nov 06, 2006 7:55 pm

Re: Multiple Menus

Post 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
User avatar
moonie
Forum Members
Forum Members
Posts: 81
Joined: Tue Feb 13, 2007 3:08 pm

Re: Multiple Menus

Post 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?
KO
Power Poster
Power Poster
Posts: 562
Joined: Mon Nov 06, 2006 7:55 pm

Re: Multiple Menus

Post 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
User avatar
moonie
Forum Members
Forum Members
Posts: 81
Joined: Tue Feb 13, 2007 3:08 pm

Re: Multiple Menus

Post 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.
Vin

Re: Multiple Menus

Post 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
Last edited by Vin on Wed Mar 14, 2007 10:30 am, edited 1 time in total.
Locked

Return to “CMSMS Core”