Page 1 of 1

[SOLVED] Hiding a specific submenu from top navigation

Posted: Fri Nov 13, 2009 1:12 pm
by Bo Mellberg
Hello!

My top menu looks like this:

MenuItem1 - MenuItem2 - MenuItem 3 - Internal

I want to show submenus on all top MenuItems, BUT "Internal". If you're not logged in, you shouldn't see what headings there are on the internal pages.

What would I modify to make this happen?

Best regards,

/Bo

Re: Hiding a specific submenu from top navigation

Posted: Fri Nov 13, 2009 2:10 pm
by Peciura
Imageing forum will give you more results. Here is just one
forum.cmsmadesimple.org/index.php/topic,38533.0.html

Also search forum for pages with page extra value set to "restricted" or group that is allowed to access that page. Key words: "extra1", "extra2", "extra3", "MenuManager"

Re: Hiding a specific submenu from top navigation

Posted: Fri Nov 13, 2009 2:50 pm
by Bo Mellberg
Thank you Peciura!

I really did search, but found only discussions about completely hiding pages from the menu. In my case I want to hide the meny from not logged in people, but when logged in, it should be visible both in top nav and side nav.

Thank you for the pointers. I tried the following:

Code: Select all

        <h2 class="accessibility">Navigation</h2>
        {menu template='plåstretmeny' number_of_levels='2' excludeprefix='interna_' }
{if $ccuser->memberof('Föräldrar')}
        {menu template='plåstretmeny' number_of_levels='2'  includeprefix='interna_' }
{else}
        {menu template='plåstretmeny' number_of_levels='1'  includeprefix='interna_' }
{/if}
        <hr class="accessibility" />
But the second meny (which is just one meny item, with or without submenu) gets located beneath the first, not to the right. Also, even if logged in, the submenu is not shown.

Re: Hiding a specific submenu from top navigation

Posted: Fri Nov 13, 2009 2:58 pm
by Bo Mellberg
Update: I managed to make my submenu appear by using start_page instead of includeprefix, doh!

The problem is still that there are two menu bars instead of one.

Best regards,

/Bo

Re: Hiding a specific submenu from top navigation

Posted: Fri Nov 13, 2009 3:08 pm
by Bo Mellberg
Solved.

I made them unshow under "options" and used show_all = 1 when logged in.

Thanks for all help!

/Bo

Re: Hiding a specific submenu from top navigation

Posted: Fri Nov 13, 2009 3:24 pm
by Peciura
Yes you did it.

But in general you need to go deeper - to edit menu template.
Open "Layout » Menu Manager" import template you want to start with. There is also very good "Module Help".
Use all this stuff to inspect template variables:

Code: Select all

{get_template_vars}, {dump item=$entry}, {$entry|debug_display}


That example includes apeariance depending on:  
1. "Extra Page Attribute 1:" of page and group that logged in visitor belongs to (or not)
2. page prefix (this one is not useful for you)

And if you like examples
search forum for pages with page extra value set to "restricted" or group that is allowed to access that page. Key words: "extra1", "extra2", "extra3", +"MenuManager"