]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - pgsrc/Help%2FTemplatePlugin
Mediawiki header
[SourceForge/phpwiki.git] / pgsrc / Help%2FTemplatePlugin
1 Date: Sat, 24 Jan 2009 8:15:24 +0000
2 Mime-Version: 1.0 (Produced by PhpWiki 1.3.14-20080124)
3 X-Rcs-Id: $Id$
4 Content-Type: application/x-phpwiki;
5   pagename=Help%2FTemplatePlugin;
6   flags=PAGE_LOCKED;
7   markup=2;
8   charset=iso-8859-1
9 Content-Transfer-Encoding: binary
10
11 The *Template* [plugin|Help:WikiPlugin] allows to include text from a wiki page and replace certain placeholders by parameters.
12
13 A template can be seen as a parametrized block. It is similiar to [CreatePage] with the template argument, but at run-time.
14
15 There are two syntaxes to call a template, the usual Phpwiki syntax for plugins, and a more
16 concise syntax similar to Mediawiki templates.
17
18 !!! Usage
19
20 <verbatim>
21 <?plugin Template page=Templates/Footer?>
22 <?plugin Template page=Templates/Film vars="title=SomeFilm&year=1999" ?>
23 {{Templates/Film|title=SomeFilm|year=1999}}
24 </verbatim>
25
26 With a specific revision of the page:
27 <verbatim>
28 <?plugin Template page=somepage rev=5 ?>
29 {{somepage?version=5}}
30 </verbatim>
31
32 If ENABLE_MARKUP_TEMPLATE is true, we support a Mediawiki-style syntax extension which maps
33 <verbatim>
34 {{TemplateFilm|title=Some Good Film|year=1999}}
35 </verbatim>
36 to
37 <verbatim>
38 <?plugin Template page=TemplateFilm vars="title=Some Good Film&year=1999" ?>
39 </verbatim>
40
41 !!! Arguments
42
43 {| class="bordered"
44 |-
45 ! Argument
46 ! Description
47 ! Default value
48 |-
49 | <b>page</b>
50 | pagename to be included as template
51 | (empty)
52 |-
53 | <b>vars</b>
54 | optional parameters to be expanded inside the template
55 | (empty)
56 |-
57 | <b>rev</b>
58 | page revision
59 | most recent revision
60 |-
61 | <b>section</b>
62 | just include a named section
63 | (empty)
64 |-
65 | <b>sectionhead</b>
66 | when including a named section show the heading
67 | (empty)
68 |}
69
70 !! Parameter expansion
71
72   vars="var1=value1&var2=value2"
73
74 We only support named parameters, not numbered ones as in Mediawiki, and
75 the placeholder is %%var%% and not ~{~{~{var~}~}~} as in Mediawiki.
76
77 The following predefined variables are automatically expanded if existing:
78 {| class="bordered"
79 |-
80 | Variable
81 | Description
82 |-
83 | pagename
84 |
85 |-
86 | mtime
87 | last modified date + time
88 |-
89 | ctime
90 | creation date + time
91 |-
92 | author
93 | last author
94 |-
95 | owner
96 |
97 |-
98 | creator
99 | first author
100 |-
101 | SERVER_URL
102 |
103 |-
104 | DATA_PATH
105 |
106 |-
107 | SCRIPT_NAME
108 |
109 |-
110 | PHPWIKI_BASE_URL
111 |
112 |-
113 | BASE_URL
114 |
115 |}
116
117 !!! Inclusion
118
119 <noinclude> .. </noinclude> is stripped.
120
121 <includeonly> .. </includeonly> is only expanded in pages using the template, not in the template itself.
122
123 !!! Examples
124
125 Standard syntax:
126 <verbatim>
127 <?plugin Template page=TemplateExample vars="title=TestTitle" ?>
128 </verbatim>
129
130 Shorter syntax:
131 <verbatim>
132 {{TemplateExample|title=TestTitle}}
133 </verbatim>
134
135 ----
136 [PhpWikiDocumentation] [CategoryWikiPlugin]