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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Bypassing template

Go to End

3 Posts   939 Views


Community Member, 22 Posts

25 June 2013 at 8:29pm

Edited: 25/06/2013 8:30pm

Sorry if this seems like a dense question, but I can't figure it out. I have a particular page type that I want to bypass the default template completely and use its own template (i.e. no layout inheritance - it needs to be completely different).

Can anyone tell me how to accomplish this? I tried putting an appropriately named template in the root 'templates' directory but it didn't work.

Nobrainer Web

Community Member, 138 Posts

26 June 2013 at 1:13am

Edited: 26/06/2013 1:15am

Hi kylehudson00,

It works like this; if a .ss file, with a matching name to current classname, is found in the root of the template folder, this file is used to render the data with. If this file contains $Layout the Layout folder folder inside the template folder is searched for a matching .ss file.
EDIT: If there is no .ss file matching the current ClassName in either of the above folders, folders will be searched for a .ss file with the parent classname - often

If you have a pagetype that you want to use a different master template for, put it directly in the themes/themename/templates/

NOTE: Remember to add ?flush=all to URL after changing template files.

Hope it helps


Community Member, 22 Posts

26 June 2013 at 6:02pm

Thanks so much for the reply! That was my understanding also, hence my confusion as to why it wasn't working.

Needless to say, I wasn't flushing the template cache - '?flush=all' solved the problem!

Thanks again.