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.

Showcase Questions /

Feedback and questions about sites in the Community Showcase.

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

Custom pagetype template issue

Go to End

3 Posts   2008 Views


Community Member, 1 Post

8 December 2013 at 3:28am

Hello to all :) I just started using SilverStripe. I followed this tutorial, everything is working fine except for the template part.

I created the file in the layouts folder and added the given code but its not getting displayed in the site(I did dev/build?flush=all),the template code is working when I add it to the layouts/ so I think the is not getting included. Am I doing anything wrong?Can someone please help me out.


Forum Moderator, 1307 Posts

9 December 2013 at 2:11am

Note that that isn't an official SilverStripe tutorial despite the logo. This tutorial doesn't support version 3.1, and the template should really use <% loop %> in stead of <% control %>. The official SilverStripe tutorials are here: (look at 5 for relation management)

After changing templates, you should just ?flush=1, never mind the dev/build, that is for updating the DataBase and in the newest versions of SilverStripe doesn't seem to flush the template cache anymore (if I'm correct, not toally shure about that)

Beside that: hard to tell what goes wrong, based on your information alone... Check for version and typo's/omissions in code and filenames I'd suggest :)



Community Member, 8 Posts

6 September 2014 at 2:14am


Every template needs a corresponding *.php file.

i.e. You want to create a page that shows Products

class PageProduct extends Page{

class PageProduct_Controller extends Page_Controller{


Then you need to create a corresponding template file called

Same thing with inheritance. You can create children for a page by creating a function, adding it to the allowed actions and creating a *.ss file with the name As soon as you redirect to that function it will call that child page.

Furthermore, you should only flush=all to clear cached images. Any time you add, or include a template, and only then, do you have to flush ON THAT PAGE (important) by doing /url/products?flush or /url/viewProduct?flush (the 1 is no longer required).

One more thing to note, it is very important that you put all the template (.ss) files in the layout folder. The way Silverstripe is built, it always loads the from themes, and where the $Layout is called in that page, it will look for a corresponding *.ss file in the layout folder. So if PageProduct was loaded, it will load and include in the $Layout variable.

Hope that helps!