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.

Template Questions /

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

What is the directory priority for templates?


Go to End


3 Posts   1422 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 :)