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