Jump to:

1382 Posts in 491 Topics by 521 members

Themes

SilverStripe Forums » Themes » Query on themes directory structure

Discuss SilverStripe Themes.

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

Page: 1
Go to End
Author Topic: 1309 Views
  • HilaryB
    Avatar
    Community Member
    11 Posts

    Query on themes directory structure Link to this post

    I have created several sites with their own theme using Silverstripe 2.3 without difficulty and am now doing my first site with 2.4. After setting the default theme in the config file. I have found that if I have the directory structure
    /themes/mytheme/templates/Layout/MyTemplate.ss
    as I have always done before then my template is not found and displayed. However if I follow the example of the new structure blackcandy has and use
    /themes/mytheme/mytheme/templates/Layout/MyTemplate.ss
    then it is found. However this means that things like the template variable $ThemeDir need to be used as
    $ThemeDir/mytheme/images etc
    which is a bit nonsensical as it is meant to do away with naming a theme dependent directory. I can't find anything about this in the documentation or forums. Have I got this right or am I missing something somewhere?

  • swaiba
    Avatar
    Forum Moderator
    1788 Posts

    Re: Query on themes directory structure Link to this post

    doesn't sound right to me... I use 2.4.x only and I've never seen this...

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: Query on themes directory structure Link to this post

    /themes/mytheme/mytheme/templates/Layout/MyTemplate.ss

    Why do you have mytheme inside mytheme? That isn't required. $ThemeDir should return themes/mytheme/

  • HilaryB
    Avatar
    Community Member
    11 Posts

    Re: Query on themes directory structure Link to this post

    I started development with blackcandy checked out from github about 3 weeks ago. That has /themes/blackcandy/blackcandy/templates etc for the main blackcandy theme css/images/templates . I found that if I didn't mirror this structure for my theme then my templates were not found. This is why I have /themes/mytheme/mytheme. I would like to get rid of this double directory layer it feels very cumbersome but I need my templates to be findable.

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: Query on themes directory structure Link to this post

    This is why I have /themes/mytheme/mytheme. I would like to get rid of this double directory layer it feels very cumbersome but I need my templates to be findable.

    Don't use the double layer. All themes should go in the root themes/ dir. It is likely you had problems with moving it up a level perhaps because you didn't run ?flush=1. Just to clear, your themes folder will need to look something like https://skitch.com/willrossi/r4nf4/templates

    1309 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.