By default each template file (*.tpl) discovered during theme scan has url matching it's location on disk:
URL | Template |
---|---|
/theme_name/some_folder/some_template_name.html | /themes/theme_name/some_folder/some_template_name.tpl |
If there is a need to change url, that would lead to that template, then special block comment needs to be added in the beginning of the template:
<!--## <NAME>Template Name</NAME> <DESC>Template Description</DESC> <SECTION>1st Level Section||2nd Level Section||3rd Level Section</SECTION> ##-->
This way template url and it's location in "Structure & Data" is completely controlled using comment block described above.
Index Page Approach
If "index.tpl
" template is present in any directory in theme, then it's content will be displayed automatically. Here is example:
URL | Template |
---|---|
/theme_name/some_folder.html | /theme_name/some_folder.tpl OR /theme_name/some_folder/index.tpl |
/theme_name/some_folder/index.html | /theme_name/some_folder/index.tpl |
Template Scan Problem
File system can't guarantee, that new filenames found in theme during it's scanning are always sorted in same way. That's why it's near to impossible to ensure, that "template_a.tpl" corresponding section would already be present by the time it will be found by theme scanner.
I have several ideas about ways to fix a problem. Please tell me what you think:
- define order for each file/folder in theme that would be used to sort files/folders during scan process
- define priority only for files/folders, that are required to be scanned first comparing to other files/folders in same folder
Order/priority definition can be made in:
- same block comment, that each template file has
- separate file, created per-folder (like .smsignore)
- single per-theme file in theme root folder
- single per-theme file in theme /install/ sub-folder (we already have theme.xml file there)