3214 Posts in 848 Topics by 810 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1273 Views |
-
Submenu always showing ?

4 January 2011 at 1:09am
Hi all
Completely newbie @ silverstripe so pleaz bear with me :0)
I downloaded some of the templates from the extensions and installed them, went smoothly :0)
However I have a question.
If I have a submenu to both "Home" and "About", they are both showing up in the sidebar at all times, no matter if I am at "Contact" or some other page.I would like it to be like this:
1) If @ "Home" show the subpages in the sidebar
2) If @ "About" show the subpages to this page and DO NOT show all other subpage menusHow can this be done?
Hope to hear from you :0)
//Carsten
-
Re: Submenu always showing ?

4 January 2011 at 8:16am
Hi Carsten,
Advice you to read this http://doc.silverstripe.org/tutorial:1-building-a-basic-site
and http://doc.silverstripe.org/built-in-page-controlsEspecially the part about menu controls
<% control Menu(2) %>
<li class="$LinkingMode"><a href="$Link" title="Go to the "{$Title}" page">$MenuTitle</a></li>
<% end_control %>Menu(1) should give you Home and all other thing on level 1. Menu(2) should give you nested pages within first level.
You could check which part you're in by doing something like beneath, but thats not very ellegant though.<% if InSection(about) %>
<% control Menu(2) %>
<li class="$LinkingMode"><a href="$Link" title="Go to the "{$Title}" page">$MenuTitle</a></li>
<% end_control %>
<% end_if %> -
Re: Submenu always showing ?

5 January 2011 at 8:18am
Hi Bart
Thanks for the reply, it helped me to find what I was searching for and now I have a working menu that splits into two: the main menu and the submenu and the submenu is only showing when I at the parent page :0)
The answer was this:
<% if Menu(2) %>
<ul><li>
<h2 class="$LinkingMode">$MenuTitle</h2>
</li></ul>
<ul id="Menu2">
<% control Menu(2) %>
<li class="$LinkingMode"><a href="$Link" title="Go to the "{$Title}" page">$MenuTitle</a></li>
<% end_control %>
</ul>
<% end_if %>
| 1273 Views | ||
|
Page:
1
|
Go to Top |


