Jump to:

3435 Posts in 1026 Topics by 866 members

Template Questions

SilverStripe Forums » Template Questions » Can you have all theme files in one directory tree?

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

Page: 1
Go to End
Author Topic: 840 Views
  • Tama
    Avatar
    Community Member
    130 Posts

    Can you have all theme files in one directory tree? Link to this post

    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

  • Willr
    Avatar
    Forum Moderator
    5490 Posts

    Re: Can you have all theme files in one directory tree? Link to this post

    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

  • Tama
    Avatar
    Community Member
    130 Posts

    Re: Can you have all theme files in one directory tree? Link to this post

    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

    840 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.