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.

Archive /

Our old forums are still available as a read-only archive.

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

Multi Coloured Menus


Go to End


3 Posts   1812 Views

Avatar
BlueO

Community Member, 52 Posts

26 July 2008 at 5:40pm

Hi all,

I'm pretty new to this and attempting to have a differently coloured menu for each major section of my site.

I thought about creating different page types for each section but there are already several different types (forum, articles etc) in each section. This means I can't use, for example, an article page in different sections without creating yet another page type.

So... is there a simple way to call up different /include/Menu.ss files depending upon what the parent/section is?

If anyone to could point me in the right direction I'd be grateful

thanks
bernard

Avatar
Willr

Forum Moderator, 5523 Posts

26 July 2008 at 10:54pm

Theres several ways to do this. You could use something like <% if InSection(SectionName) %> - http://doc.silverstripe.com/doku.php?id=built-in-page-controls#links_and_class_s or you could do something like id="$ClassName" in your html to change colors etc as this would generate id="BlogPage" for BlogPage, id="Page" for any pages of type page then in the CSS you could use #BlogPage {} for custom styles on BlogPages

Avatar
BlueO

Community Member, 52 Posts

27 July 2008 at 11:53am

Excellent,

The

<% if InSection() %>
worked perfectly.

Thank you willr

bernard