Bug: User topic Templates aren't found the way the documentation presents the search order
I'm trying to use a user topic in a Web, to define a view template for this web's specific skin, instead of having to change things into
.../templates/
I think there is a bug (either in the code or the docs, but rather in the code) in the way the search for the right topic is done.
The documentation (see the left column of the table at
TWikiTemplates states that the order is the following, "if a skin is specified" :
-
templates/%WEB%/script.skin.tmpl
-
templates/script.skin.tmpl
-
data/%WEB%/SkinSkinScriptTemplate.txt
-
data/TWiki/SkinSkinScriptTemplate.txt
But instead, if I add new skin template in a topic which is named
SkinSkinScriptTemplate, what I noticed is that the following is looked for in the
_readTemplateFile() function :
-
templates/%WEB%/script.skin.tmpl
-
templates/script.skin.tmpl
-
templates/script.tmpl
-
data/%WEB%/SkinSkinScriptTemplate.txt
-
data/TWiki/SkinSkinScriptTemplate.txt
I think that in
TWiki::Store::_readTemplateFile(), the "default" case (i.e. loading script.tmpl, the third step, here) should apply only in the end, if nothing else worked, and especially if no user topic named
SkinSkinScriptTemplate was found...
I will try to provide a clean patch as soon as this is confirmed to be a bug and the doc are indeed right...
Test case
- Create a new Web, say Foo
- Add a topic named FooSkinViewTemplate defining a new template
- Define Set SKIN = foo in Foo's WebPreferences
The pages in the Foo web should be viewed according to the new view template.
Environment
--
OlivierBerger - 01 Jul 2005
Impact and Available Solutions
Follow up
Added a comment in
TWiki.TWikiTemplates to track this problem.
--
OlivierBerger - 01 Jul 2005
Fix record
Discussion