]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - pgsrc/Help%2FTemplatePlugin
New help page: Help%2FAdobe%20Flash
[SourceForge/phpwiki.git] / pgsrc / Help%2FTemplatePlugin
1 Date: Fri, 20 Sep 2010 13:46:13 +0000
2 Mime-Version: 1.0 (Produced by PhpWiki 1.4.0RC1)
3 X-Rcs-Id: $Id$
4 Content-Type: application/x-phpwiki;
5   pagename=Help%2FTemplatePlugin;
6   flags=PAGE_LOCKED%2CEXTERNAL_PAGE;
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 | **version**
77 | page revision (same as ##rev##)
78 | most recent revision
79 |-
80 | **section**
81 | just include a named section
82 | (empty)
83 |-
84 | **sectionhead**
85 | when including a named section show the heading
86 | (empty)
87 |}
88
89 === Page to include ===
90
91 If "Template:$page" exists, it is used.
92
93 Else, if "Template/$page" exists, it is used.
94
95 Else "$page" is used.
96
97 This allows compatibility with Mediawiki that puts templates in the "Template:" namespace.
98
99 === Parameter expansion ===
100
101 We only support named parameters, not numbered ones as in Mediawiki, and
102 the placeholder is %%var%% and not ~{~{~{var~}~}~} as in Mediawiki.
103
104 {{{
105 vars="var1=value1&var2=value2"
106 }}}
107
108 The following predefined variables are automatically expanded if existing:
109 {| class="bordered"
110 |-
111 ! Variable
112 ! Description
113 |-
114 | pagename
115 |
116 |-
117 | mtime
118 | last modified date + time
119 |-
120 | ctime
121 | creation date + time
122 |-
123 | author
124 | last author
125 |-
126 | owner
127 |
128 |-
129 | creator
130 | first author
131 |-
132 | SERVER_URL
133 |
134 |-
135 | DATA_PATH
136 |
137 |-
138 | SCRIPT_NAME
139 |
140 |-
141 | PHPWIKI_BASE_URL
142 |
143 |-
144 | BASE_URL
145 |
146 |}
147
148 == Inclusion ==
149
150 ~<noinclude> .. ~</noinclude> is stripped.
151
152 ~<includeonly> .. ~</includeonly> is only expanded in pages using the template, not in the template itself.
153
154 <noinclude>
155 ----
156 [[PhpWikiDocumentation]] [[CategoryWikiPlugin]]
157 </noinclude>