Jump to:

3443 Posts in 1030 Topics by 871 members

Template Questions

SilverStripe Forums » Template Questions » What is the directory priority for templates?

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

Page: 1
Go to End
Author Topic: 364 Views
  • mattdwen
    Avatar
    Community Member
    12 Posts

    What is the directory priority for templates? Link to this post

    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?

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: What is the directory priority for templates? Link to this post

    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.

  • mattdwen
    Avatar
    Community Member
    12 Posts

    Re: What is the directory priority for templates? Link to this post

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

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