Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Different templates for different pages.

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

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

Page: 1 2
Go to End
Author Topic: 3458 Views
  • Iain_vdw
    Avatar
    Community Member
    22 Posts

    Re: Different templates for different pages. Link to this post

    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!

  • Iain_vdw
    Avatar
    Community Member
    22 Posts

    Re: Different templates for different pages. Link to this post

    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.

    3458 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.