Help with menu manager

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
cpansewicz
Forum Members
Forum Members
Posts: 142
Joined: Fri Jun 17, 2011 12:22 am

Help with menu manager

Post by cpansewicz »

Hi,

I have a main menu on my site set-up to show 2 levels. I hope I can explain this well. I would like the menu to show 3 levels, but only for one menu item. Could somebody help me figure out how to accomplish this?

The template for my menu is:

Code: Select all

{if $count > 0}
<ul id="nav">
  {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->parent == true or ($node->current == true and $node->haschildren == true)}
  <li {if $node->menutext eq 'Ways of Giving'} id="gift"{/if} class="on">
    {elseif $node->current == active}
  <li {if $node->menutext eq 'Ways of Giving'} id="gift"{/if} class="on">
    {else}
  <li {if $node->menutext eq 'Ways of Giving'} id="gift"{/if} class="off">
    {/if}
  <a href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}>
          {if $node->hierarchy|count_characters < 4}<span>{/if}
          {$node->menutext}
          {if $node->hierarchy|count_characters < 4}</span>{/if}
          </a>
          {/foreach}
          {repeat string="</li></ul>" times=$node->depth-1}</li>
          </ul>
    {/if}
Basically what I would like is below:

>Item A (lists children)
>>Sub-Item A
>>Sub-Item B
>>Sub-Item C (list the children of Item C)

Thank you!
Last edited by velden on Wed Apr 22, 2015 7:10 pm, edited 1 time in total.
Reason: added code block
JohnnyB
Dev Team Member
Dev Team Member
Posts: 729
Joined: Tue Nov 21, 2006 5:05 pm
Location: OH, USA

Re: Help with menu manager

Post by JohnnyB »

Is it possible to toggle on and off which pages you want to show in the menu (under the Options tab)? Then, when you have your level 1 and level 2 pages and the extra level 3 pages assigned to show in the menu, while all other pages are not assigned to show in the menu, you can use a regular old nested list menu template.
"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: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Help with menu manager

Post by velden »

I think it's possible to call the menu from inside the menu manager:

Code: Select all

{if $count > 0}
{* store this nodelist in a new variable *}
{$org_nodelist = $nodelist}

  {* use the new variable in the foreach loop *}
  {foreach from=$org_nodelist item=node}
   
     {$if node->alias == 'alias-of-menu-c'}
       {menu childrenof='alias-of-menu-c' template='other-menu-template'}
     {/if} 
   {/foreach}
...
    {/if}
Note the use of an extra variable to store the nodelist in. And note that therefore you should not use the exact same template for the 'submenu'. Why? Because the variables have a global scope, and calling the menu from inside this template will overwrite the original 'nodelist'. That could/will give strange problems.
cpansewicz
Forum Members
Forum Members
Posts: 142
Joined: Fri Jun 17, 2011 12:22 am

Re: Help with menu manager

Post by cpansewicz »

Yes, I would like to implement it that way. Thank you both for your ideas. I will play around with them.

On another note, is it possible to set-up a mega menu, like the attached image in CMS Made Simple?
Attachments
image.png
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12709
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Help with menu manager

Post by Dr.CSS »

Yes it is possible...
cpansewicz
Forum Members
Forum Members
Posts: 142
Joined: Fri Jun 17, 2011 12:22 am

Re: Help with menu manager

Post by cpansewicz »

Thank you!
Post Reply

Return to “Modules/Add-Ons”