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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Template Questions /

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

What is the directory priority for templates?


Go to End


3 Posts   1009 Views

Avatar
mattdwen

Community Member, 12 Posts

14 February 2014 at 5:58pm

Edited: 14/02/2014 5:59pm

I have the following structure in a custom theme:
- src
- src/templates
- templates

The /src/templates are compiled into the /templates dir using Grunt. However the files from /src/templates are actually the files which get loaded.

I thought it may be parsing the folders alphabetically, so I renamed src to zzz, run a flush=all, and still the template from zzz/templates was the file loaded.

It wasn't until I renamed zzz/templates to zzz/nottemplates that the correct templates/Page.ss was loaded.

Why are sub folders checked for template directories? Surely this a reasonable performance hit checking every subfolder except the real templates for it's own templates directory?

Avatar
Willr

Forum Moderator, 5523 Posts

15 February 2014 at 10:38pm

Why are sub folders checked for template directories? Surely this a reasonable performance hit checking every subfolder except the real templates for it's own templates directory?

As it's part of the manifest, it's only a performance hit on flush. If you include a _manifest_exclude_ file in src/templates that should get it ignored.

Avatar
mattdwen

Community Member, 12 Posts

20 February 2014 at 1:23pm

Thanks Willr, I had to remove the trailing _ but it worked a treat, cheers :)