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.

Template Questions /

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

Can you have all theme files in one directory tree?


Go to End


3 Posts   1446 Views

Avatar
Tama

Community Member, 138 Posts

12 October 2009 at 8:55am

Is it possible to put all of the theme files in a single directory tree to make them easier to manage?

For example if I'm running Silverstripe with the blogging module the theme files seem to live in the following places:
/blog/css
/blog/images
/blog/templates
/themes/mytheme/css
/themes/mytheme/images
/themes/mytheme/templates
/themes/mytheme_blog/css
/themes/mytheme_blog/images
/themes/mytheme_blog/templates

Adding additional modules increases this complexity even further.

For ease of management I'd like to store everything theme related in one place - for example:
/themes/mytheme/css
/themes/mytheme/images
/themes/mytheme/templates

Is there any process/ trick/ switch/ easy hack to allow me to do this?

Cheers
Tama

Avatar
Willr

Forum Moderator, 5523 Posts

12 October 2009 at 9:23am

I would have thought that the files for modules could have gone into themes/mysite/templates/

I am pretty sure the template engine looks for templates in this order

Looking for the 'BlogHolder' template
1 Your custom themes module folder (themes/mytheme_blog/templates/)
2 Your custom theme folder (themes/mytheme/templates/)
3 The default location (blog/templates)

You shouldn't need to edit the templates in blog/ You should simply copy the files you want to override into the themes/mytheme/templates/ directory and edit them there.

So in conclusion - yes I believe you can keep all the template files in themes/mytheme/templates* and SS will still pick it up

Avatar
Tama

Community Member, 138 Posts

12 October 2009 at 9:39am

Hi Will - thanks for the prompt reply, it's really appreciated.

I wondered if this was the case but my site didn't seem to be overriding changes to /themes/mytheme/templates from /blog/templates so I wasn't sure about the priority. The addition of /themes/mytheme_blog threw me a little too.

With what you wrote in mind I'll rationalise all of the my theme files into one directory tree and go from there.

Thanks again

Tama