]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - pgsrc/Help%2FTemplatePlugin
Better layout
[SourceForge/phpwiki.git] / pgsrc / Help%2FTemplatePlugin
1 Date: Mon, 17 Jan 2011 17:13:41 +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 | **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 === Page to include ===
86
87 If "Template:$page" exists, it is used.
88
89 Else, if "Template/$page" exists, it is used.
90
91 Else "$page" is used.
92
93 This allows compatibility with Mediawiki that puts templates in the "Template:" namespace.
94
95 === Parameter expansion ===
96
97 We only support named parameters, not numbered ones as in Mediawiki, and
98 the placeholder is %%var%% and not ~{~{~{var~}~}~} as in Mediawiki.
99
100 {{{
101 vars="var1=value1&var2=value2"
102 }}}
103
104 The following predefined variables are automatically expanded if existing:
105 {| class="bordered"
106 |-
107 ! Variable
108 ! Description
109 |-
110 | pagename
111 |
112 |-
113 | mtime
114 | last modified date + time
115 |-
116 | ctime
117 | creation date + time
118 |-
119 | author
120 | last author
121 |-
122 | owner
123 |
124 |-
125 | creator
126 | first author
127 |-
128 | SERVER_URL
129 |
130 |-
131 | DATA_PATH
132 |
133 |-
134 | SCRIPT_NAME
135 |
136 |-
137 | PHPWIKI_BASE_URL
138 |
139 |-
140 | BASE_URL
141 |
142 |}
143
144 == Inclusion ==
145
146 ~<noinclude> .. ~</noinclude> is stripped.
147
148 ~<includeonly> .. ~</includeonly> is only expanded in pages using the template, not in the template itself.
149
150 <noinclude>
151 ----
152 [[PhpWikiDocumentation]] [[CategoryWikiPlugin]]
153 </noinclude>