Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » Templating Question

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

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

Page: 1
Go to End
Author Topic: 947 Views
  • Blackdog
    Community Member
    156 Posts

    Templating Question Link to this post

    I am setting up a site which effectively splits off into 2 sub sites.

    Section 1
    - Some Page
    - Some Other Page
    Section 2
    - Some Page
    - Some Other Page

    My problem is I wish for each section to use a seperate master template. It is so I can vary the css and javascript between them.

    At the moment it works fine for Level 2 ( Section 1 & 2 ) but as soon as I move down into Level 3 it reverts back to using the Page.ss template, am I missing something?


  • mikehenrty
    Community Member
    2 Posts

    Re: Templating Question Link to this post

    Hmm, what is your inheritance structure?

    I was thinking that Homepage is of type Page. Then you have two Page subclasses, something like "class Section1 extends Page" and "class Section2 extends Page." And then your master templates for those sections would be Section1.ss and Section2.ss. If this is what you have, make sure your level three pages are of Section1/Section2 page type, or a subclass thereof. Also make sure your two master templates are in every level of your template folders (i.e. template, templates/Layout, etc)

    Also, you can force you level 3 pages to render with particular templates using the page controller with something like this:

    return $this->renderWith(array('SomePageSection2', 'Section2'));

    So, it will look for SomePageSection2.ss and then Section2.ss to try and render the page with.

    Does this help? If not, what is you template folder structure?


Page: 1
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.