Use Menu Manager and Items List for 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.
Post Reply
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: Use Menu Manager and Items List for multiple menus

Post by JohnnyB »

just add, items="home, about, services, products, my-account"
where those names represent the page alias:
;http://my-domain.com/about ===> "about" is the page alias
Last edited by Dr.CSS on Tue Mar 04, 2014 10:11 pm, edited 1 time in total.
Reason: Please use double quotes or something on fake links so they aren't clickable...
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Use Menu Manager and Items List for multiple menus

Post by velden »

I think you should start updating your cmsms installation to the most recent version.

About the menu:

I'd consider creating a slightly customized menu template; leave the opening and closing <div> and/or <ul> out. In the example below I've named it 'customtemplatename'.

Then create a page hierarchy:

Code: Select all

- general (section header)
  - home  (page)
  - about  (page)
- unit1 (section header)
  - page A
  - page B
  - ...
- unit2 (section header)
  - page D
  - page E
  - ...
- unit3 (section header)
  - page G
  - page H
  - ...
Then use two {menu} calls:

Code: Select all

<div id="menuwrapper">
<ul id="primary-nav">
{menu template='customtemplatename' childrenof='general'}
{menu template='customtemplatename' childrenof='unit1'}
</ul>
</div>
You could then create 3 templates, one for every business unit. Each with their own call to menu or think of some logic to dynamically find the current section header/parent.

There would also be a more static approach: hardcode the general menu items in the menu template. But that would mean an editor should not add or remove those general pages, nor change the alias of those. Thinking of it: you wouldn't easily know whether those static menu items are current page for styling etc. So don't think it's a good approach.

Code: Select all

{* CSS classes used in this template:
#menuwrapper - The id for the <div> that the menu is wrapped in. Sets the width, background etc. for the menu.
#primary-nav - The id for the <ul>
.menuparent - The class for each <li> that has children.
.menuactive - The class for each <li> that is active or is a parent (on any level) of a child that is active. *}

{assign var='number_of_levels' value=10000}
{if isset($menuparams.number_of_levels)}
  {assign var='number_of_levels' value=$menuparams.number_of_levels}
{/if}

{if $count > 0}
<div id="menuwrapper">
<ul id="primary-nav">

{* hard coded menu items at the beginning *}
<li>{cms_selflink page='home'}</li>
<li>{cms_selflink page='about'}</li>

{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
  ...
{/if}
{/foreach}
{repeat string='</li><li class="separator once" style="list-style-type: none;">&nbsp;</li></ul>' times=$node->depth-1}
</li>

{* hard coded menu items at the end *}
<li>{cms_selflink page='contact'}</li>

</ul>
<div class="clearb"></div>
</div>
{/if}
Post Reply

Return to “CMSMS Core”