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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

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


Go to End


4 Posts   908 Views

Avatar
Schippie

Community Member, 38 Posts

20 September 2013 at 10:49am

Edited: 20/09/2013 10:56am

I probably have a really silly question but i cannot get my homepage.php to use the homepage.ss template located in <mysite>/templates/homepage.ss 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

Avatar
Bambii7

Community Member, 254 Posts

20 September 2013 at 11:57am

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

Avatar
Schippie

Community Member, 38 Posts

20 September 2013 at 5:26pm

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.

Avatar
Schippie

Community Member, 38 Posts

20 September 2013 at 7:33pm

Edited: 20/09/2013 8:05pm

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/HeaderHome.ss.

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 footer.ss within footer.ss is not a great idea :P