<<O>>  Difference Topic TWikiTemplates (r1.23 - 15 Aug 2004 - PeterThoeny)

META TOPICPARENT WebHome
TOC: No TOC in "TWiki.TWikiTemplates"
Line: 59 to 59

HTML Page Templates

Changed:
<
<
TWiki uses HTML template files for all actions, like topic view, edit, and preview. This allows you to change the look and feel of all pages by editing just a few template files.
>
>
TWiki uses HTML template files for all actions, like topic view, edit, and preview. This allows you to change the look and feel of all pages by editing just a few template files.

Changed:
<
<
Templates are in the twiki/templates directory. As an example, twiki/templates/view.tmpl is the template file for the twiki/bin/view script. Templates can be overloaded by individual webs. The following search order applies:
>
>
Templates are stored either in the twiki/templates directory or in user topics. As an example, twiki/templates/view.tmpl is the template file for the twiki/bin/view script.

Changed:
<
<
  1. twiki/templates/$webName/$scriptName.tmpl
  2. twiki/templates/$scriptName.tmpl
    • $webName is the name of the web (ex: Main)
    • $scriptName is the script (ex: view).
>
>
HELP Templates can be overloaded by individual webs.

Changed:
<
<
HELP NOTE: TWikiSkins can be defined to overload the standard templates.
>
>
HELP TWikiSkins can overload the standard templates.

TWiki uses the following search order to determine which template to use:

If a skin is specified If no skin is specified
templates/%WEB%/script.skin.tmpl templates/%WEB%/script.tmpl
templates/script.skin.tmpl templates/script.tmpl
data/%WEB%/SkinSkinScriptTemplate.txt data/%WEB%/ScriptTemplate.txt
data/TWiki/SkinSkinScriptTemplate.txt data/TWiki/ScriptTemplate.txt
Legend:
script refers to the script name, e.g view, edit
Script refers to the same, but with the first character capitalized, e.g View
skin refers to the skin name, e.g dragon, pattern
Skin refers to the same, but with the first character capitalized, e.g Dragon
%WEB% refers to the current web

Additionally (and primarily for use in %TMPL:INCLUDE{}%) the template name may be a wiki topic name, specified as Web.Topic, in which case the search is:

If a skin is specified If no skin is specified
templates/web/Web.Topic.skin.tmpl templates/web/Web.Topic.tmpl
templates/Web.Topic.skin.tmpl templates/Web.Topic.tmpl
data/Web/Topic.txt
If Web is not specified in the INCLUDE, it defaults to TWiki, and the search to the first type.

Special variables are used in templates, especially in view, to display meta data.

Line: 149 to 166

templatetopic The name of the template topic, e.g. topic used to copy the initial content
topicparent Sets the parent topic
TopicClassification Assuming the template topic has a form with a field called "TopicClassification", it will set the value of the field
Added:
>
>
contenttype Optional parameter that defines the application type to write into the CGI header. Defaults to text/html. May be used to invoke alternative client applications

anyname Any parameter can passed to the new topic; if the template topic contains %URLPARAM{"anyname"}%, it will be replaced by its value
Line: 252 to 270

  • A drawback of referring to a master template is that you can only test a template from within TWiki, where the include variables are resolved. In the previous system, each template was a structurally complete HTML document with a .tmpl filename extension - it contained unresolved %VARIABLES%, but could still be previewed directly in a browser.
Changed:
<
<
-- TWiki:Main.PeterThoeny - 25 Apr 2004
>
>
-- TWiki:Main.CrawfordCurrie - 30 Jun 2004
-- TWiki:Main.PeterThoeny - 15 Aug 2004

-- TWiki:Main.MikeMannix - 14 Sep 2001
-- TWiki:Main.DavidLeBlanc - 11 Mar 2002
Revision r1.22 - 25 Apr 2004 - 07:07 - PeterThoeny
Revision r1.23 - 15 Aug 2004 - 21:22 - PeterThoeny