|
META TOPICPARENT | name="WebHome" |
|
|
HTML Page Templates |
|
< < | 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. |
| |
|
< < | 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. |
| |
|
< < |
-
twiki/templates/$webName/$scriptName.tmpl
-
twiki/templates/$scriptName.tmpl
-
$webName is the name of the web (ex: Main )
-
$scriptName is the script (ex: view ).
|
> > | Templates can be overloaded by individual webs. |
| |
|
< < | NOTE: TWikiSkins can be defined to overload the standard templates. |
> > | 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 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. |
|
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 |
|
|
> > |
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 |
|
|
- 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.
|
|
< < | -- 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 |