Line: 1 to 1 | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||
Line: 36 to 36 | |||||||||||||||||||||||
| |||||||||||||||||||||||
Changed: | |||||||||||||||||||||||
< < | New Template System by Example | ||||||||||||||||||||||
> > | TWiki Master TemplateAll common parts are defined in a master template,twiki.tmpl , that all other templates use.
Types of TemplateThere are two types of templates:
HTML Page TemplatesThe Caboteria uses HTML template files for all actions like topic view, edit, preview and so on. This allows you to change the look and feel of all pages by editing just some template files. The template files are in thetwiki/templates directory. As an example, twiki/templates/view.tmpl is the template file for the twiki/bin/view script. Templates can be overloaded per web. The following search order applies:
$webName is the name of the web ( i.e. Main ), and $scriptName is the script ( i.e. view ).
Note: TWikiSkins can be defined to overload the standard templates.
Some special variables are used in templates ( especially view ) to show meta data - see Meta Data Rendering
Template TopicsTemplate topics define the default text for new topics. There are three types of template topics:All template topics are located in the TWiki web. The WebTopicEditTemplate can be overloaded. The following search order applies when you create a new topic:
Template Topics in ActionHere is an example for creating new topics based on a specific template topic: Above form asks for a topic name. A hidden input tag of name "templatetopic" specifies the ExampleTopicTemplate as the template topic. Here is the HTML source of the form:<form name="new" action="%SCRIPTURLPATH%/edit%SCRIPTSUFFIX%/%WEB%/"> * New example topic: <input type="text" name="topic" value="ExampleTopic%SERVERTIME{$year$mo$day}%" size="22"> <input type="hidden" name="templatetopic" value="ExampleTopicTemplate"> <input type="hidden" name="onlywikiname" value="on"> <input type="submit" value="Create"> (date format is YYYYMMDD) </form>The "onlywikiname" parameter enforces WikiWords for topic names. Note: Use can use the %WIKIUSERNAME% and %DATE% variables in your topic templates as the signature; those variables are expanded when a new topic is created. The standard topic signature is: -- %WIKIUSERNAME% - %DATE%
Templates by Example | ||||||||||||||||||||||
Attached is an example of an oops base template oopsbase.tmpl and a example oops dialog oopstest.tmpl which is based on the base template. NOTE: This isn't the release version, just a quick, simple demo. | |||||||||||||||||||||||
Line: 44 to 119 | |||||||||||||||||||||||
The first line declares the delimiter variable called "sep", used to separate multiple link items. The variable can be called anywhere by writing %TMPL:P{"sep"}% | |||||||||||||||||||||||
Changed: | |||||||||||||||||||||||
< < | |||||||||||||||||||||||
> > | |||||||||||||||||||||||
| |||||||||||||||||||||||
Line: 90 to 165 | |||||||||||||||||||||||
Deleted: | |||||||||||||||||||||||
< < | |||||||||||||||||||||||
Test template oopstest.tmplEach oops template basically just defines some variables and includes the base template that does the layout work. | |||||||||||||||||||||||
Changed: | |||||||||||||||||||||||
< < | |||||||||||||||||||||||
> > | |||||||||||||||||||||||
| |||||||||||||||||||||||
Line: 126 to 200 | |||||||||||||||||||||||
With URL: .../bin/oops/Test/TestTopic2?template=oopstest¶m1=WebHome¶m2=WebNotify | |||||||||||||||||||||||
Changed: | |||||||||||||||||||||||
< < | |||||||||||||||||||||||
> > | |||||||||||||||||||||||
| |||||||||||||||||||||||
Deleted: | |||||||||||||||||||||||
< < | TWiki master templateAll common template parts are defined in one master template,twiki.tmpl , that all other templates include.
Example: | ||||||||||||||||||||||
Known Issues
| |||||||||||||||||||||||
Changed: | |||||||||||||||||||||||
< < | -- PeterThoeny - 23 Jul 2001 -- MikeMannix - 30 Aug 2001 | ||||||||||||||||||||||
> > | -- PeterThoeny - 23 Jul 2001 -- MikeMannix - 14 Sep 2001 | ||||||||||||||||||||||
|