Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

customising menus


Go to End


2 Posts   2294 Views

Avatar
archiseek

Community Member, 1 Post

12 June 2009 at 6:43am

I have the following site structure

main menu item 1
sub menu item 1
sub menu item 2
sub menu item 3
sub menu item 4

main menu item 2
sub menu item 1
sub menu item 2
sub menu item 3
sub menu item 4

main menu item 3

when in main menu item 1, the side nav shows the children pages
sub menu item 1
sub menu item 2
sub menu item 3
sub menu item 4

when in sub menu item 1, i want it to show its "sibling" pages ie
sub menu item 2
sub menu item 3
sub menu item 4

Avatar
bummzack

Community Member, 904 Posts

12 June 2009 at 8:05am

Use <% if LinkOrCurrent = current %> to see if the page is currently active.
Something like

<ul>
<% control Menu(1) %>
<% if LinkOrCurrent = current %>
<% else %>
<li><a href="$Link">$Title</a></li>
<% end_if %>
<% end_control>
</ul>