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.

Themes

Discuss SilverStripe Themes.

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

Query on themes directory structure


Reply

5 Posts   1322 Views

Avatar
HilaryB

12 April 2011 at 2:43am Community Member, 11 Posts

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

12 April 2011 at 2:51am Forum Moderator, 1796 Posts

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

Avatar
Willr

13 April 2011 at 8:35pm Forum Moderator, 5511 Posts

/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

14 April 2011 at 4:14am Community Member, 11 Posts

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

14 April 2011 at 11:37am Forum Moderator, 5511 Posts

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