Bug: PatternSkin does not support template loading order
It is possible to provide web-specific templates by creating a subdirectory in the template directory with the same name as the web. Any template file in that directory will be loaded in preference over the template files in
templates/. All other templates are taken from the standard directory. For example, if you have a web
Sandbox, then if there is a template file
/templates/Sandbox/view.tmpl, this view template will be used instead of
/templates/view.tmpl.
This also works in cairo under
ClassicSkin. However, using
PatternSkin this does not work in all circumstances. It is not exactly clear to me what happens, but I think that then the standard template directory is not searched for template files not in the created subdirectory. However, I have not tested out all possible situations.
Test case
Create a subdirectory of the templates directory, say
templates/Sandbox per the above example. Copy
templates/view.tmpl into
templates/Sandbox. Now (under
PatternSkin) you will suddenly notice that the topics are rendered without top or bottom bars and actions. Note that if
templates/view.pattern.tmpl is copied into the subdirectory, things seem to work.
This seems particularly strange as the presence of the
templates/Sandbox/view.tmpl file should not affect the
PatternSkin. Note that if applying other skins, such as plain or print does not show the same problem.
Environment
--
ThomasWeigert - 29 Jan 2005
Follow up
The load order is supposed to be:
- in
templates/$web, look for
- file
$name.$skin.tmpl
- file
$name.tmpl
- in
templates, look for
- file
$name.$skin.tmpl
- file
$name.tmpl
- if a template is not found, tries in this order
- parse
$name into a web name and a topic name and looks for this topic
- looks for topic
$name in $web
- looks for topic
${skin}Skin${topic}Template in $web
- looks for topic
${topic}Template in $web
- looks for
topic ${skin}Skin${topic}Template in TWiki::cfg{SystemWebName}.
- looks for topic
${topic}Template in TWiki::cfg{SystemWebName}.
Thus if you are viewing a topic, and have view.tmpl in the Web dir, it will override
view.pattern.tmpl in the main dir.
I agree this is rather strange, but that's the way it's always been.
--
CrawfordCurrie - 03 May 2005
I think the real problem is that
ClassicSkin is chosen when
any arbitrary skin name is used (including the empty skin name). The empty skin name should be reserved for a fall back that works for any skin (i.e., only define the most simple template building blocks (such as maybe pagebegin, pageend, etc.)
We should use
view.classic etc. for
ClassicSkin, otherwise we always run the risk that changes to classic skin mess with all other skins.
--
ThomasWeigert - 03 May 2005
You got my vote.
- Move all classic templates to
*.classic.tmpl
- create the smallest possible skin that could work to replace it as the default
--
CrawfordCurrie - 03 May 2005
What I am thinking here is that the "basic" templates would have all the shared elements (e.g., all the
oops*.tmpl and whatever else common one can peel out). Hopefully that would drive also towards less duplication (often we now have exactly the same template as classic and pattern except for maybe one style added somewhere.
--
ThomasWeigert - 03 May 2005
Note for the record: I changed the templates load order as described in
SkinSearchPath to be more "natural".
--
CrawfordCurrie - 08 May 2005
Fix record