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

Templates not Showing in the CMS

Go to End

11 Posts   2314 Views


7 September 2010 at 7:45am Community Member, 13 Posts

I think this ought to be in here, as it seems a bit basic for the Templates forum, but sorry if I'm wrong!

I've just started working with this excellent CMS, and am following the tutorials to learn how to get the most out of it. My problem is with creating a new template. I've created a HomePage.php file in /mysite/code, added a and to /themes/tutorial/templates/Layout, and added the $Layout tag to the file in /themes/tutorial/templates. I have also flushed the database using ?flush=1, as the tutorial states. However, when I go back into the CMS, the new HomePage template doesn't show up in the list - only the Page template and the other ones that come by default.

I've searched around, and this problem seems to have come up before, but only on 2.3 - I'm running 2.4. Does anybody have any idea what's wrong, or is it something stupid that I've missed, somewhere?


7 September 2010 at 8:00am Community Member, 271 Posts

Not sure what you mean with 'Does not show op in the CMS', but in SiteConfig there is only a list with installed themes, not seperate template files.

In the create list in the CMS Left pagetype select dropdown, should be all PageTypes you created.

SS will select the templates based on the PageType classname and the corresponding template filename.

Also you might try to use ?flush=all .


7 September 2010 at 6:34pm Community Member, 13 Posts

OK, I'll try and explain it a bit better.

When I created a template as per the tutorial, after using ?flush=1, the list of templates does not show the new HomePage template - neither under the Create button on the left, or in the Behaviour tab of any page. I've followed all of the Tutorial instructions, and when it talks about changing the PageType of an existing page, I can't, because the new Template isn't in the list to change it to.

I've just tried ?flush=all, and that doesn't work either.


7 September 2010 at 8:21pm Community Member, 901 Posts

You're confusing things here. I think you mean a new "Page-Type" and not a new template. The types you can select in the CMS for creation are "Page-Types".
To make new types available you have to run dev/build


8 September 2010 at 3:20am Community Member, 13 Posts

OK, I see now. Yes, it is a Page Type that I'm meaning. However, I don't see what you mean by /dev/build - the only dev folder I can find is /sapphire/dev, and it doesn't have any file called build in it. Even so, the tutorial maintains that you use ?flush=1, and that makes it available. Have I missed a /dev folder, or is there some other problem?


8 September 2010 at 4:01am (Last edited: 8 September 2010 4:12am), Community Member, 271 Posts

Running dev/build, recreates the Manifest file which stores Class information from Silverstripe and will rebuild the database.

In order to let Silverstripe know you added a new PageType, you need to rebuild the Manifest file and the database.

You do this by adding dev/build to your site like:

You will see a blue screen which shows information about which database tables and fields are changed.

See this page for more info:[]=dev#building_and_publishing_urls

The dev part is redirected to (sapphire/dev/)DevelopmentAdmin(.php) with Director::addRules() in sapphire/_config.php;

From there the specific task is run.

Yoy can see the available tasks by only appending only /dev to your siteurl.


8 September 2010 at 5:27am Community Member, 13 Posts

When I enter, I get a 404 Page not Found error, as if the CMS isn't redirecting the request. I also tried directly accessing the file by, and got a 404 again.


8 September 2010 at 5:57am Community Member, 271 Posts

Ehm, you did not really tried

I mean

And if you installed in a subfolder something like:

Make sure you have set Director::set_environment_type("dev"); in you config.php file.

Go to Top