Page 1 of 1
[SOLVED] Menu Manager Hiding Levels
Posted: Thu Dec 23, 2010 3:09 pm
by mr.bacan
Hello everyone,
I'm having problems hiding some menu levels, and I've tried using start_level, collapse, and number_of_levels and it didn't worked.
My menu is something like this:
- Home
- Products
-- Menu 1
--- SubMenu 1
---- SubSubMenu 1
--- SubMenu 2
---- SubSubMenu 2
---- SubSubMenu 3
-- Menu 2
--- SubMenu 3
What I'm trying to achieve is to show just the content for a given level, for example if I'm on SubMenu 2 I just want the menu to show:
--- SubSubMenu 2
--- SubSubMenu 3
Instead it is showing also the content for SubMenu 1.
Could anyone please give me a hand with this?
Thanks in advance.
Mr. Bacan
Re: Menu Manager Hiding Levels
Posted: Thu Dec 23, 2010 4:26 pm
by konsument
collapse="1" should do the work
Re: Menu Manager Hiding Levels
Posted: Thu Dec 23, 2010 4:33 pm
by Dr.CSS
Find the template this page uses and see how the menu tag is called, I think it does what you want...
http://multiintech.com/defaultcontent/i ... ge=navleft
Re: Menu Manager Hiding Levels
Posted: Mon Dec 27, 2010 1:38 pm
by mr.bacan
Thanks for your suggestions, but it's not working as needed.
I tried different combination using collapse and nothing. I also tried using the same menu from the template you suggested Dr.CSS, and nothing.
So I tried this on my main template (not on my Menu Manager Template):
{if $node->depth == 2}
{menu start_level='2' number_of_levels='1'}
{elseif $node->depth == 3}
{menu start_level='3' number_of_levels='1'}
{else}
{menu start_level='4' number_of_levels='1'}
{/if}
But this didn't worked as I thought, because it is only showing level 4 menu contents, and when I'm on level 2 or level 3 it shows nothing.
Thanks for any advice you could give on this.
Re: Menu Manager Hiding Levels
Posted: Mon Dec 27, 2010 1:53 pm
by uniqu3
Code: Select all
{if $node->depth == 2}
{menu start_level='2' number_of_levels='1'}
{elseif $node->depth == 3}
{menu start_level='3' number_of_levels='1'}
{else}
{menu start_level='4' number_of_levels='1'}
{/if}
This doesn't work in template, node is used in MenuManager template.
All you need is one menu call in template {menu collapse='1' template='yourMMtemplate'} the rest is done with CSS and MenuManager Template.
Re: Menu Manager Hiding Levels
Posted: Mon Dec 27, 2010 2:25 pm
by mr.bacan
Thanks for your reply unique3, I already tried what you suggested, in fact it is how I'm using it right now and is not what I'm looking for.
Check how it's displaying right now using
{menu collapse='1'}
http://beta.nexorone.com/en/integration-scheme.html
What I need, is when I'm on that level the menu just shows that level's items.
I also tried {menu collapse='1' number_of_levels='1'} and nothing
Thanks again for your support.
Re: Menu Manager Hiding Levels
Posted: Mon Dec 27, 2010 3:01 pm
by uniqu3
So if i understand it right, you need 1st level navigation in the sidebar, if level is deeper than 1 than only children of that level should be shown??
If your answer is yes:
Create a UDT, call it level and install CGSimpleSmarty
Code: Select all
$gCms = cmsms();
$hierarchy = count(explode(".", $gCms->variables['friendly_position']));
$smarty->assign('level', $hierarchy);
In your template:
Code: Select all
{*get title of parent page with cgsimplesmarty*}
{$cgsimple->get_page_title($cgsimple->get_parent_alias(), 'parenttitle')}
{*call level udt*}
{level}
{*if level is greater or equal 2*}
{if ($level gte '2')}
{*show menu with children of parent page*}
{menu childrenof=$parenttitle}
{else}
{*if level is 1 show main menu*}
{menu number_of_levels='1'}
{/if}
or something like this
Code: Select all
{level}
{menu start_level=$level number_of_levels='1'}
But in the second option i dont know how would you come to second level :)
Well at least i hope you got some pointers from this and can find your way to get your menu working :)
Actualy you could do it your way to
Code: Select all
{level}
{if ($level eq '2')}
{menu start_level='2' number_of_levels='1'}
{elseif ($level eq '3')}
{menu start_level='3' number_of_levels='1'}
{elseif ($level eq '4')}
{menu start_level='4' number_of_levels='1'}
{else}
{menu}
{/if}
(SOLVED) Menu Manager Hiding Levels
Posted: Mon Dec 27, 2010 3:43 pm
by mr.bacan
You saved me unique3, thank you very very much.
The first and last codes worked perfectly, but the one that I'm going to use because it gives me the option to even call different templates depending on the level is:
Code: Select all
{level}
{if ($level eq '2')}
{menu start_level='2' number_of_levels='1'}
{elseif ($level eq '3')}
{menu start_level='3' number_of_levels='1'}
{elseif ($level eq '4')}
{menu start_level='4' number_of_levels='1'}
{else}
{menu}
{/if}
Thanks again.