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

How to get Silverstripe to use templates in <mysite> folder


4 Posts   327 Views


20 September 2013 at 10:49am (Last edited: 20 September 2013 10:56am), Community Member, 32 Posts

I probably have a really silly question but i cannot get my homepage.php to use the template located in <mysite>/templates/ It just reverts back to the default silverstripe theme for some reason.

I would like to use the mysite folder for the reason that i want to have all files in one folder nicely grouped together css js php and templates.
But i cannot seem to get it to use those templates.

It when i flush=all / 1 gives timeout errors/exceeding memory limit and when i remove the cache manually from the appdata it reverts back to the default theme.

PS: i posted this i think in the wrong section if somebody could move it for me :S


20 September 2013 at 11:57am Community Member, 254 Posts

Hi Schippie,
could you check/post your classes in side homepage.php

for example I have

class HomePage extends Page
class HomePage_Controller extends Page_Controller

Then I have


20 September 2013 at 5:26pm Community Member, 32 Posts

They indeed extend from the default Page classes and not from the sitetree / contentcontroller classes.
I would be able to post some code but only in a few hours. Posted it as a question after work and have the code only available to me at work.


20 September 2013 at 7:33pm (Last edited: 20 September 2013 8:05pm), Community Member, 32 Posts

Turns out i had written the HomePage class name as HomaPage never noticed yesterday. Though that brings me more or less to the next problem that is that <% include HeaderHome %> was the cause of the timeout errors. While the file is simply within the templates folder like : <mysite>/templates/Includes/

Edit: after some more searching i found the problem in the form of old code still left in that template before the switch to 3.1 where we decided to redo most of the templates/javascript etc. turns out including within is not a great idea :P