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.

Themes /

Discuss SilverStripe Themes.

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

Query on themes directory structure


Go to End


5 Posts   2317 Views

Avatar
HilaryB

Community Member, 11 Posts

12 April 2011 at 2:43am

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?

Avatar
swaiba

Forum Moderator, 1899 Posts

12 April 2011 at 2:51am

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

Avatar
Willr

Forum Moderator, 5523 Posts

13 April 2011 at 8:35pm

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

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

Avatar
HilaryB

Community Member, 11 Posts

14 April 2011 at 4:14am

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.

Avatar
Willr

Forum Moderator, 5523 Posts

14 April 2011 at 11:37am

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