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

Templating Question

Go to End

2 Posts   1170 Views


Community Member, 156 Posts

14 April 2008 at 3:03pm

Edited: 14/04/2008 3:05pm

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 template, am I missing something?



Community Member, 2 Posts

17 April 2008 at 10:36am

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 and 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 and then to try and render the page with.

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