Jump to:

23370 Posts in 18145 Topics by 2864 members

General Questions

SilverStripe Forums » General Questions » Bypassing Page.ss template

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

Page: 1
Go to End
Author Topic: 326 Views
  • kylehudson00
    Avatar
    Community Member
    22 Posts

    Bypassing Page.ss template Link to this post

    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.

  • Nobrainer Web
    Avatar
    Community Member
    134 Posts

    Re: Bypassing Page.ss template Link to this post

    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

  • kylehudson00
    Avatar
    Community Member
    22 Posts

    Re: Bypassing Page.ss template Link to this post

    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.

    326 Views
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.