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, biapar, Willr, Ingo, swaiba, simon_w

Bypassing Page.ss template


Reply

3 Posts   360 Views

Avatar
kylehudson00

25 June 2013 at 8:29pm (Last edited: 25 June 2013 8:30pm), Community Member, 22 Posts

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 Page.ss 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.

Avatar
Nobrainer Web

26 June 2013 at 1:13am (Last edited: 26 June 2013 1:15am), Community Member, 135 Posts

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 Page.ss.

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

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

Hope it helps

Avatar
kylehudson00

26 June 2013 at 6:02pm Community Member, 22 Posts

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.