Tags:
create new tag
view all tags

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

TWiki version: TWikiRelease02Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: XP
Web server: Apache
Perl version: 5
Client OS: XP
Web Browser: IE

-- ThomasWeigert - 29 Jan 2005

Follow up

The load order is supposed to be:

  1. in templates/$web, look for
    1. file $name.$skin.tmpl
    2. file $name.tmpl
  2. in templates, look for
    1. file $name.$skin.tmpl
    2. file $name.tmpl
  3. if a template is not found, tries in this order
    1. parse $name into a web name and a topic name and looks for this topic
    2. looks for topic $name in $web
    3. looks for topic ${skin}Skin${topic}Template in $web
    4. looks for topic ${topic}Template in $web
    5. looks for topic ${skin}Skin${topic}Template in TWiki::cfg{SystemWebName}.
    6. 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

Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2005-05-08 - CrawfordCurrie
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.