• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

The current search order for template files won't find per web overrides using the web topic formalism unless all of the default templates are removed, which seems a bit extreme.

For example, I would like to override the view template for a web using the topic override formalism of web.SkinSkinScriptTemplate (e.g. Sandbox.PatternSkinViewTemplate).

According to the standard (non-deprecated) search order specified in TWikiTemplates and implemented in TWiki::Templates::_readTemplateFile, the only way that the topic will be used is if both templates/view.pattern.tmpl and templates/view.tmpl are non-existent. This implies that I'd have to delete the default templates and implement web specific templates for all of the webs in order to override the templates for a single web.

I think the order should be like this (cribbing a bit from TWikiTemplates):

  1. The TWiki topic web.topic if the template name can be parsed into web.topic
  2. The TWiki topic web.SkinSkinScriptTemplate for each skin on the skin path
  3. The TWiki topic web.ScriptTemplate
  4. The TWiki topic TWiki.SkinSkinScriptTemplate for each skin on the skin path
  5. The TWiki topic TWiki.ScriptTemplate
  6. templates/script.skin.tmpl for each skin on the skin path
  7. templates/script.tmpl

I'm marking this as Urgent, as I think the current behavior pretty much renders the functionality unusable.

DiabJerius


I've attached a patch against Templates.pm which implements the above search order and simplifies the search code so that less work is done. Not a big optimization, but it may help a bit.

DiabJerius


Granted that overriding with a topic might seem desireable. However the order is the way it is for two good reasons:

  1. Compatibility with earlier TWiki releases, in the event that users have a topic named such that it would override a template, the search order has minimum "FUD impact"
  2. It is far more efficient to look up templates than topics

I do not think we should change this now; it is high risk. Discarding.

CC


With the deprecation of the previous method of per-web overrides, this marks a step backwards in usability. It's now more difficult to specialize webs, and there is a much larger barrier to the creation of new applications. There's a greater chance that things will break during an upgrade, which is a painful enough process.

DiabJerius

ItemTemplate
Summary Template search order is partially inverted
ReportedBy TWiki:Main.DiabJerius
Codebase 4.0.2
SVN Range Thu, 04 May 2006 build 10073
AppliesTo Engine
Component

Priority Urgent
CurrentState No Action Required
WaitingFor

Checkins

TargetRelease n/a
Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatpatch Templates.pm.patch r1 manage 5.3 K 2006-05-05 - 20:47 DiabJerius Patch to Templates.pm (4.0.2) to fix search order and optimize search routine
Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2006-05-09 - DiabJerius
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback