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

How to hide secondary side nav items when their first level isn't selected?


Go to End


2 Posts   1335 Views

Avatar
Chilly53

Community Member, 1 Post

28 September 2010 at 11:10am

I am having trouble with my left navigation. Basically, I have several top level pages and then sub pages underneath these pages. I want the sub-pages to display in the left navigation only when I am on the corresponding top level page or any of the sub-pages within that section. Is this possible?

Avatar
Willr

Forum Moderator, 5523 Posts

28 September 2010 at 2:59pm

I believe you want to use <% if LinkOrSection = section %>

LinkOrSection will return section if you are on that page or a child of it and link otherwise. See the documentation for more information - http://doc.silverstripe.org/built-in-page-controls#links_and_classes