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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

Different templates for different pages.

Go to End

10 Posts   4306 Views


Community Member, 22 Posts

31 October 2008 at 11:41pm

Just using $URLSegment returns the name of the page you're currently on. In need the name of the section each page belongs to, the Level1 page names.

I'll see if the code from NathanB works later today, i'll report back here if it's the right solution.

Thanks for the help everyone!


Community Member, 22 Posts

1 November 2008 at 2:07am

NathanB, your solution works! Thanks alot!

Now i've only got to implement two classes in my css file, one with a static jpg background for the homepage and random images for the other pages :)

Implemented as followed:

<div id="plaatje" class="<% control Level(1) %>$URLSegment<% end_control %>">

This returns the name of the top level section for every subitem as well. This way i can link in my css file for id=home to a static jpg and for the rest of the pages use a random image generator.

Go to Top