]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - pgsrc/Help%2FTemplatePlugin
Wikicreole syntax
[SourceForge/phpwiki.git] / pgsrc / Help%2FTemplatePlugin
1 Date: Fri,  6 Mar 2009 09:48:31 +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** [[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 {{{
21 <<Template page=Templates/Footer>>
22 <<Template page=Templates/Film vars="title=SomeFilm&year=1999">>
23 {{Templates/Film|title=SomeFilm|year=1999}}
24 }}}
25
26 With a specific revision of the page:
27 {{{
28 <<Template page=somepage rev=5>>
29 {{somepage?version=5}}
30 }}}
31
32 If ENABLE_MARKUP_TEMPLATE is true, we support a Mediawiki-style syntax extension which maps
33 {{{
34 {{TemplateFilm|title=Some Good Film|year=1999}}
35 }}}
36 to
37 {{{
38 <<Template page=TemplateFilm vars="title=Some Good Film&year=1999">>
39 }}}
40
41 == Arguments
42
43 {| class="bordered"
44 |-
45 ! Argument
46 ! Description
47 ! Default value
48 |-
49 | **page**
50 | pagename to be included as template
51 | (empty)
52 |-
53 | **vars**
54 | optional parameters to be expanded inside the template
55 | (empty)
56 |-
57 | **rev**
58 | page revision
59 | most recent revision
60 |-
61 | **section**
62 | just include a named section
63 | (empty)
64 |-
65 | **sectionhead**
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 {{{
127 <<Template page=TemplateExample vars="title=TestTitle">>
128 }}}
129
130 Shorter syntax:
131 {{{
132 {{TemplateExample|title=TestTitle}}
133 }}}
134
135 <noinclude>
136 ----
137 [[PhpWikiDocumentation]] [[CategoryWikiPlugin]]
138 </noinclude>