1 [[template id=plugin name=template included=1 author="""[[Joey]]"""]]
4 With this plugin, you can set up templates, and cause them to be filled out
5 and inserted into pages in the wiki. Using a template works like this:
7 \[[template id=foo name="Charley" color="red" age=11]]
9 This fills out the template `templates/foo`, filling in the `color` and `age`
10 fields on it with the specified values, and inserts the result into the page.
12 If a value is triple-quoted, it can include any markup that would be
13 allowed in the wiki page outside the template. Combined with multi-line
14 quoted values, this allows for large chunks of marked up text to be
15 embedded into a template:
17 \[[template id=foo name="Sally" color="green" age=8 notes="""
18 * \[[Charley]]'s sister.
19 * Really 8 and a half.
20 * Wants to be an astronaut when she grows up.
23 To create a template, make a page in the wiki named `template/foo`. Note
24 that this is a different location than the directory used for the
25 [[templates]] used to build the wiki itself, which is not inside the wiki.
27 The template uses the syntax used by the HTML::Template perl module, which
28 allows for some fairly complex things to be done. Consult its documentation
29 for the full syntax, but all you really need to know are a few things:
31 * To insert the value of a variable, use `<TMPL_VAR variable>`.
32 * To make a block of text conditional on a variable being set use
33 `<TMPL_IF NAME="variable">text</TMPL_IF>`.
35 Here's a sample template:
37 <span class="infobox">
38 Name: <TMPL_VAR name><br />
39 Age: <TMPL_VAR age><br />
40 <TMPL_IF NAME="color">
41 Favorite color: <TMPL_VAR color><br />
43 No favorite color.<br />
45 <TMPL_IF NAME="notes">