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

Different templates for different pages.


Go to End


10 Posts   5116 Views

Avatar
Iain_vdw

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!

Avatar
Iain_vdw

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