]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - pgsrc/Help%2FTemplatePlugin
Use UTF-8 so that display is correct on sf.net
[SourceForge/phpwiki.git] / pgsrc / Help%2FTemplatePlugin
1 Date: Thu, 26 Mar 2009 11:34:32 +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=UTF-8
9 Content-Transfer-Encoding: binary
10
11 The **Template** [[Help:WikiPlugin|plugin]] 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 === Without parameters
21
22 Plugin syntax:
23 {{{
24 <<Template page=Footer>>
25 }}}
26
27 Short syntax:
28 {{{
29 {{Footer}}
30 }}}
31
32 === With parameters
33
34 Plugin syntax:
35 {{{
36 <<Template page=Film vars="title=SomeFilm&year=1999">>
37 }}}
38
39 Short syntax:
40 {{{
41 {{Film|title=SomeFilm|year=1999}}
42 }}}
43
44 === With a specific revision of the page
45
46 Plugin syntax:
47 {{{
48 <<Template page=somepage rev=5>>
49 }}}
50
51 Short syntax:
52 {{{
53 {{somepage?version=5}}
54 }}}
55
56 == Arguments
57
58 {| class="bordered"
59 |-
60 ! Argument
61 ! Description
62 ! Default value
63 |-
64 | **page**
65 | pagename to be included as template
66 | (empty)
67 |-
68 | **vars**
69 | optional parameters to be expanded inside the template
70 | (empty)
71 |-
72 | **rev**
73 | page revision
74 | most recent revision
75 |-
76 | **section**
77 | just include a named section
78 | (empty)
79 |-
80 | **sectionhead**
81 | when including a named section show the heading
82 | (empty)
83 |}
84
85 === Parameter expansion
86
87 We only support named parameters, not numbered ones as in Mediawiki, and
88 the placeholder is %%var%% and not ~{~{~{var~}~}~} as in Mediawiki.
89
90 {{{
91 vars="var1=value1&var2=value2"
92 }}}
93
94 The following predefined variables are automatically expanded if existing:
95 {| class="bordered"
96 |-
97 ! Variable
98 ! Description
99 |-
100 | pagename
101 |
102 |-
103 | mtime
104 | last modified date + time
105 |-
106 | ctime
107 | creation date + time
108 |-
109 | author
110 | last author
111 |-
112 | owner
113 |
114 |-
115 | creator
116 | first author
117 |-
118 | SERVER_URL
119 |
120 |-
121 | DATA_PATH
122 |
123 |-
124 | SCRIPT_NAME
125 |
126 |-
127 | PHPWIKI_BASE_URL
128 |
129 |-
130 | BASE_URL
131 |
132 |}
133
134 == Inclusion
135
136 ~<noinclude> .. ~</noinclude> is stripped.
137
138 ~<includeonly> .. ~</includeonly> is only expanded in pages using the template, not in the template itself.
139
140 <noinclude>
141 ----
142 [[PhpWikiDocumentation]] [[CategoryWikiPlugin]]
143 </noinclude>