none
[openafs-wiki.git] / TWiki / TWikiVariables.mdwn
1 ## <a name="TWiki Variables"></a> TWiki Variables
2
3 ### <a name="Predefined Variables"></a> Predefined Variables
4
5 %WIKITOOLNAME% expands the following variables enclosed in % percent signs:
6
7 <table border="1">
8   <tr>
9     <th> Variable: </th>
10     <th> Expanded to: </th>
11   </tr>
12   <tr>
13     <td><code>%WIKIHOMEURL%</code></td>
14     <td> The base script URL of %WIKITOOLNAME%, is the link of the Home icon in the upper left corner, is <b>%WIKIHOMEURL%</b></td>
15   </tr>
16   <tr>
17     <td><code>%SCRIPTURL%</code></td>
18     <td> The script URL of %WIKITOOLNAME%, is <b>http://www.dementia.org/twiki/</b></td>
19   </tr>
20   <tr>
21     <td><code>%SCRIPTURLPATH%</code></td>
22     <td> The path of the script URL of %WIKITOOLNAME%, is <b>http://www.dementia.org/twiki/</b></td>
23   </tr>
24   <tr>
25     <td><code>%SCRIPTSUFFIX%</code></td>
26     <td> The script suffix, i.e. <code>.pl</code>, is <b></b></td>
27   </tr>
28   <tr>
29     <td><code>%PUBURL%</code></td>
30     <td> The public URL of TWiki, is <b>http://www.dementia.org/twiki//view</b></td>
31   </tr>
32   <tr>
33     <td><code>%PUBURLPATH%</code></td>
34     <td> The path of the public URL of %WIKITOOLNAME%, is <b>http://www.dementia.org/twiki//view</b></td>
35   </tr>
36   <tr>
37     <td><code>%ATTACHURL%</code></td>
38     <td> The attachment URL of the current topic, is <b>http://www.dementia.org/twiki//view</b><br /> Example: If you attach a file you can refer to it as <code><b>%ATTACHURL%/image.gif</b></code></td>
39   </tr>
40   <tr>
41     <td><code>%ATTACHURLPATH%</code></td>
42     <td> The path of the attachment URL of the current topic, is <b>http://www.dementia.org/twiki//view</b></td>
43   </tr>
44   <tr>
45     <td><code>%URLPARAM{"name"}%</code></td>
46     <td> Returns the value of a URL parameter. I.e. <code>%URLPARAM{"skin"}%</code> returns <b>print</b> for a <code>.../view/%WEB%/%TOPIC%?skin=print</code> URL. Is <b></b></td>
47   </tr>
48   <tr>
49     <td><code>%WIKITOOLNAME%</code></td>
50     <td> Name of wiki tool, is <b>%WIKITOOLNAME%</b></td>
51   </tr>
52   <tr>
53     <td><code>%WIKIVERSION%</code></td>
54     <td> Wiki tool version, is <b>TWiki-4.1.2, Sat, 03 Mar 2007, build 13046</b></td>
55   </tr>
56   <tr>
57     <td><code>%USERNAME%</code></td>
58     <td> Your login username, is <b>admin</b></td>
59   </tr>
60   <tr>
61     <td><code>%WIKIUSERNAME%</code></td>
62     <td> Your Wiki username, if defined in [[Main/TWikiUsers]]. Same as %USERNAME% if not defined. Is <b>Main.admin</b></td>
63   </tr>
64   <tr>
65     <td><code>%WEB%</code></td>
66     <td> The current web, is <b>%WEB%</b></td>
67   </tr>
68   <tr>
69     <td><code>%BASEWEB%</code></td>
70     <td> The web name where the includes started, e.g. the web of the first topic of nested includes. Same as <code>%WEB%</code> in case there is no include. </td>
71   </tr>
72   <tr>
73     <td><code>%INCLUDINGWEB%</code></td>
74     <td> The web name of the topic that includes the current topic. Same as <code>%WEB%</code> in case there is no include. </td>
75   </tr>
76   <tr>
77     <td><code>%TOPIC%</code></td>
78     <td> The current topic name, is <b>%TOPIC%</b></td>
79   </tr>
80   <tr>
81     <td><code>%BASETOPIC%</code></td>
82     <td> The name of the topic where the includes started, e.g. the first topic of nested includes. Same as <code>%TOPIC%</code> in case there is no include. </td>
83   </tr>
84   <tr>
85     <td><code>%INCLUDINGTOPIC%</code></td>
86     <td> The name of the topic that includes the current topic. Same as <code>%TOPIC%</code> in case there is no include. </td>
87   </tr>
88   <tr>
89     <td><code>%SPACEDTOPIC%</code></td>
90     <td> The current topic name with added spaces, for regular expression search of Ref-By, is <b></b></td>
91   </tr>
92   <tr>
93     <td><code>%TOPICLIST{"format"}%</code></td>
94     <td> Topic index of a web. Parameter is composed of the format, followed by an optional <code>web="Name"</code>. The <code>"format"</code> defines the format of one topic item; use it to create any formatting you need. The <code>$name</code> variable is expanded to the topic name; the <code>$web</code> variable is expanded to the name of the web. Examples: <br /><code>%TOPICLIST{"   * $web.$name"}%</code> creates a bullet list of all topics. <br /><code>%TOPICLIST{" &lt;option&gt;$name&lt;/option&gt;"}%</code> creates an option list (for drop down menus). </td>
95   </tr>
96   <tr>
97     <td><code>%WEBLIST{"format"}%</code></td>
98     <td> Web index, e.g. list of all webs. Hidden webs are excluded, e.g. webs with a <code>NOSEARCHALL=on</code> preference variable. The <code>"format"</code> defines the format of one web item. The <code>$name</code> variable is expanded to the name of the web. Example: <br /><code>%WEBLIST{"   * [[$name.WebHome]]"}%</code> creates a bullet list of all webs. </td>
99   </tr>
100   <tr>
101     <td><code>%GMTIME%</code></td>
102     <td> GM time, is <b>29 Jun 2010 - 15:26</b></td>
103   </tr>
104   <tr>
105     <td><code>%GMTIME{"format"}%</code></td>
106     <td> Formatted GM time based on time variables. <table border="1" cellpadding="0" cellspacing="0">
107         <tr>
108           <th bgcolor="#99CCCC"><strong> Variable: </strong></th>
109           <th bgcolor="#99CCCC"><strong> Unit: </strong></th>
110           <th bgcolor="#99CCCC"><strong> Example </strong></th>
111         </tr>
112         <tr>
113           <td> $seconds </td>
114           <td> seconds </td>
115           <td> 59 </td>
116         </tr>
117         <tr>
118           <td> $minutes </td>
119           <td> minutes </td>
120           <td> 59 </td>
121         </tr>
122         <tr>
123           <td> $hours </td>
124           <td> hours </td>
125           <td> 23 </td>
126         </tr>
127         <tr>
128           <td> $day </td>
129           <td> day of month </td>
130           <td> 31 </td>
131         </tr>
132         <tr>
133           <td> $month </td>
134           <td> month in ISO format </td>
135           <td> Dec </td>
136         </tr>
137         <tr>
138           <td> $mo </td>
139           <td> 2 digit month </td>
140           <td> 12 </td>
141         </tr>
142         <tr>
143           <td> $year </td>
144           <td> 4 digit year </td>
145           <td> 1999 </td>
146         </tr>
147         <tr>
148           <td> $ye </td>
149           <td> 2 digit year </td>
150           <td> 99 </td>
151         </tr>
152       </table> Variables can be shortened to 3 characters. Example: <br /><code>%GMTIME{"$day $month, $year - $hour:$min:$sec"}%</code> is <br /><b>29 Jun, 2010 - 15:26:37</b></td>
153   </tr>
154   <tr>
155     <td><code>%SERVERTIME%</code></td>
156     <td> Server time, is <b>29 Jun 2010 - 11:26</b></td>
157   </tr>
158   <tr>
159     <td><code>%SERVERTIME{"format"}%</code></td>
160     <td> Formatted server time. <br /> Example: <code>%SERVERTIME{"$hou:$min"}%</code> is <b>11:26</b></td>
161   </tr>
162   <tr>
163     <td><code>%HTTP_HOST%</code></td>
164     <td> HTTP_HOST environment variable, is <b></b></td>
165   </tr>
166   <tr>
167     <td><code>%REMOTE_ADDR%</code></td>
168     <td> REMOTE_ADDR environment variable, is <b></b></td>
169   </tr>
170   <tr>
171     <td><code>%REMOTE_PORT%</code></td>
172     <td> REMOTE_PORT environment variable, is <b></b></td>
173   </tr>
174   <tr>
175     <td><code>%REMOTE_USER%</code></td>
176     <td> REMOTE_USER environment variable, is <b></b></td>
177   </tr>
178   <tr>
179     <td><code>%INCLUDE{"page" ...}%</code></td>
180     <td> Server side include to [[Main/IncludeTopicsAndWebPages]]. The parameter is composed of the page name, followed by an optional <code>pattern="(reg-exp)"</code> pair. The page name is: <table border="1" cellpadding="0" cellspacing="0">
181         <tr>
182           <td><code>"SomeTopic"</code></td>
183           <td> The name of a topic located in the current web, i.e. <code>%INCLUDE{"WebNotify"}%</code></td>
184         </tr>
185         <tr>
186           <td><code>"Web.Topic"</code></td>
187           <td> A topic in another web, i.e. <code>%INCLUDE{"TWiki.TWikiWebsTable"}%</code></td>
188         </tr>
189         <tr>
190           <td><code>"http://..."</code></td>
191           <td> A full qualified URL, i.e. <code>%INCLUDE{"http://twiki.org/"}%</code></td>
192         </tr>
193       </table>
194     </td>
195   </tr>
196   <tr>
197     <td><code>%STARTINCLUDE%</code></td>
198     <td> If present in included topic, start to include text from this location up to the end, or up to the location of the <code>%STOPINCLUDE%</code> variable. A normal view of the topic shows everyting exept the <code>%STARTINCLUDE%</code> variable itself. </td>
199   </tr>
200   <tr>
201     <td><code>%STOPINCLUDE%</code></td>
202     <td> If present in included topic, stop to include text at this location and ignore the remaining text. A normal view of the topic shows everyting exept the <code>%STOPINCLUDE%</code> variable itself. </td>
203   </tr>
204   <tr>
205     <td><code>%TOC%</code></td>
206     <td> Table of Content of current topic. </td>
207   </tr>
208   <tr>
209     <td><code>%TOC{"SomeTopic" ...}%</code></td>
210     <td> Table of Content. Shows a TOC that is generated automatically based on headings of a topic. Headings in [[Main/WikiSyntax]] (<code>"---++ text"</code>) and HTML (<code>"&lt;h2&gt;text&lt;h2&gt;"</code>) are taken into account. Parameter is composed of the topic name, followed by optional <code>name="value"</code> pairs: <table border="1" cellpadding="0" cellspacing="0">
211         <tr>
212           <th bgcolor="#99CCCC"><strong> Pair: </strong></th>
213           <th bgcolor="#99CCCC"><strong> Description: </strong></th>
214           <th bgcolor="#99CCCC"><strong> Default: </strong></th>
215         </tr>
216         <tr>
217           <td><code>web="Name"</code></td>
218           <td> Name of web </td>
219           <td> Current web </td>
220         </tr>
221         <tr>
222           <td><code>depth="2"</code></td>
223           <td> Limit depth of headings shown in TOC </td>
224           <td> 6 </td>
225         </tr>
226       </table> Examples: <code><b>%TOC{depth="2"}%</b></code>, <code><b>%TOC{"TWikiDocumentation" web="TWiki"}%</b></code></td>
227   </tr>
228   <tr>
229     <td><code>%SEARCH{"str" ...}%</code></td>
230     <td> Inline search, shows a search result embedded in a topic. Parameter is composed of the search term (enclosed in double quotes), followed by optional <code>name="value"</code> pairs: [1] <table border="1" cellpadding="0" cellspacing="0">
231         <tr>
232           <th bgcolor="#99CCCC"><strong> Pair: </strong></th>
233           <th bgcolor="#99CCCC"><strong> Description: </strong></th>
234           <th bgcolor="#99CCCC"><strong> Default: </strong></th>
235         </tr>
236         <tr>
237           <td><code>search="food"</code></td>
238           <td> Search term, (either regex or literal, depending on the <code>regex</code> parameter) </td>
239           <td> (used if initial search term is missing) </td>
240         </tr>
241         <tr>
242           <td><code>web="Name"</code><br /><code>web="Main Know"</code><br /><code>web="all"</code></td>
243           <td> Wiki web to search: A web, a list of webs separated by whitespace, or <code>all</code> webs. [2] </td>
244           <td> Current web </td>
245         </tr>
246         <tr>
247           <td><code>scope="topic"</code><br /><code>scope="text"</code></td>
248           <td> Search topic name (title) or in the text (body) of the topic </td>
249           <td> Topic text (body) </td>
250         </tr>
251         <tr>
252           <td><code>order="topic"</code><br /><code>order="modified"</code><br /><code>order="editby"</code></td>
253           <td> Sort the results of search by the topic names, last modified time, or last editor </td>
254           <td> Sort by topic name </td>
255         </tr>
256         <tr>
257           <td><code>limit="all"</code><br /><code>limit="16"</code></td>
258           <td> Limit the number of results returned </td>
259           <td> All results </td>
260         </tr>
261         <tr>
262           <td><code>regex="on"</code></td>
263           <td>[[Main/RegularExpression]] search </td>
264           <td> Literal search </td>
265         </tr>
266         <tr>
267           <td><code>reverse="on"</code></td>
268           <td> Reverse the direction of the search </td>
269           <td> Ascending search </td>
270         </tr>
271         <tr>
272           <td><code>casesensitive="on"</code></td>
273           <td> Case sensitive search </td>
274           <td> Ignore case </td>
275         </tr>
276         <tr>
277           <td><code>nosummary="on"</code></td>
278           <td> Show topic title only </td>
279           <td> Show topic summary </td>
280         </tr>
281         <tr>
282           <td><code>bookview="on"</code></td>
283           <td>[[Main/BookView]] search, e.g. show complete topic text </td>
284           <td> Show topic summary </td>
285         </tr>
286         <tr>
287           <td><code>nosearch="on"</code></td>
288           <td> Suppress search string </td>
289           <td> Show search string </td>
290         </tr>
291         <tr>
292           <td><code>noheader="on"</code></td>
293           <td> Suppress search header <br /><span style="background: #FFB0B0"> <strong>Topics: Changed: By:</strong> </span></td>
294           <td> Show search header </td>
295         </tr>
296         <tr>
297           <td><code>nototal="on"</code></td>
298           <td> Do not show number of topics found </td>
299           <td> Show number </td>
300         </tr>
301       </table> Example: <code><b>%SEARCH{"wiki" web="Main" scope="topic"}%</b></code></td>
302   </tr>
303   <tr>
304     <td><code>%VAR{"NAME" web="Web"}%</code></td>
305     <td> Get a preference value from a web other then the current one. Example: To get <code>%WEBBGCOLOR%</code> of the Main web write <code>%VAR{"WEBBGCOLOR" web="Main"}%</code>, is <code><b></b></code></td>
306     <td>
307       <p>
308       </p>
309     </td>
310   </tr>
311 </table>
312
313 [1] **_Note_**: The search form uses identical names for input fields.
314
315 [2] **_Note_**: A web can be excluded from a `web="all"` search if you define a `NOSEARCHALL=on` variable in its [[WebPreferences]].
316
317 ### <a name="Preferences Variables"></a> Preferences Variables
318
319 Additional variables are defined in the preferences ( site-level ( **_SL_** ) in [[TWikiPreferences]], web-level ( **_WL_** ) in [[WebPreferences]] of each web, and user level ( **_UL_** ) preferences in individual user topics):
320
321 <table border="1">
322   <tr>
323     <th> Variable: </th>
324     <th> Level: </th>
325     <th> What: </th>
326   </tr>
327   <tr>
328     <td><code>%WIKIWEBMASTER%</code></td>
329     <td><strong><em>SL</em></strong></td>
330     <td> Webmaster email address (sender of email notifications) , is <b></b></td>
331   </tr>
332   <tr>
333     <td><code>%WIKIWEBLIST%</code></td>
334     <td><strong><em>SL</em></strong></td>
335     <td> List of %WIKITOOLNAME% webs (in upper right corner of topics) </td>
336   </tr>
337   <tr>
338     <td><code>%WEBTOPICLIST%</code></td>
339     <td><strong><em>WL</em></strong></td>
340     <td> Common links of web (second line of topics) </td>
341   </tr>
342   <tr>
343     <td><code>%WEBCOPYRIGHT%</code></td>
344     <td><strong><em>SL</em></strong> , <strong><em>WL</em></strong></td>
345     <td> Copyright notice (bottom right corner of topics) </td>
346   </tr>
347   <tr>
348     <td><code>%WEBBGCOLOR%</code></td>
349     <td><strong><em>WL</em></strong></td>
350     <td> Background color of web </td>
351   </tr>
352   <tr>
353     <td><code>%NOSEARCHALL%</code></td>
354     <td><strong><em>WL</em></strong></td>
355     <td> Exclude web from a <code>web="all"</code> search (set variable to <code>on</code> for hidden webs) </td>
356   </tr>
357   <tr>
358     <td><code>%NEWTOPICBGCOLOR%</code></td>
359     <td><strong><em>SL</em></strong> , <em>UL</em></td>
360     <td> Background color of non existing topic. ( <strong><em>UL</em></strong> needs authentication for topic views ) </td>
361   </tr>
362   <tr>
363     <td><code>%NEWTOPICFONTCOLOR%</code></td>
364     <td><strong><em>SL</em></strong> , <em>UL</em></td>
365     <td> Font color of non existing topic. ( <strong><em>UL</em></strong> needs authentication for topic views ) </td>
366   </tr>
367   <tr>
368     <td><code>%EDITBOXWIDTH%</code></td>
369     <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
370     <td> Horizontal size of edit box, is <b> <code>%EDITBOXWIDTH%</code> </b></td>
371   </tr>
372   <tr>
373     <td><code>%EDITBOXHEIGHT%</code></td>
374     <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
375     <td> Vertical size of edit box, is <b> <code>%EDITBOXHEIGHT%</code> </b></td>
376   </tr>
377   <tr>
378     <td><code>%ATTACHLINKBOX%</code></td>
379     <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
380     <td> Default state of the link check box in the attach file page. Check box is initially checked if value is set to <code>CHECKED</code> , unchecked if empty. If checked, a link is created to the attached file at the end of the topic. Value is: <b><code>%ATTACHLINKBOX%</code></b></td>
381   </tr>
382   <tr>
383     <td><code>%HTTP_EQUIV_ON_VIEW%</code></td>
384     <td><strong><em>SL</em></strong></td>
385     <td> http-equiv meta tags for view, rdiff, attach, search* scripts. </td>
386   </tr>
387   <tr>
388     <td><code>%HTTP_EQUIV_ON_EDIT%</code></td>
389     <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
390     <td> http-equiv meta tags for edit script. </td>
391   </tr>
392   <tr>
393     <td><code>%HTTP_EQUIV_ON_PREVIEW%</code></td>
394     <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
395     <td> http-equiv meta tags for preview script. </td>
396   </tr>
397   <tr>
398     <td><code>%DENYWEBCHANGE%</code></td>
399     <td><strong><em>WL</em></strong></td>
400     <td> List of users and groups who are <strong>not allowed</strong> to change topics in the %WIKITOOLNAME% web. (More in [[Main/TWikiAccessControl]]) </td>
401   </tr>
402   <tr>
403     <td><code>%ALLOWWEBCHANGE%</code></td>
404     <td><strong><em>WL</em></strong></td>
405     <td> List of users and groups who are <strong>allowed</strong> to change topics in the %WIKITOOLNAME% web. (More in [[Main/TWikiAccessControl]]) </td>
406   </tr>
407   <tr>
408     <td><code>%DENYTOPICCHANGE%</code></td>
409     <td><strong><em>(any topic)</em></strong></td>
410     <td> List of users and groups who are <strong>not allowed</strong> to change the current topic. (More in [[Main/TWikiAccessControl]]) </td>
411   </tr>
412   <tr>
413     <td><code>%ALLOWTOPICCHANGE%</code></td>
414     <td><strong><em>(any topic)</em></strong></td>
415     <td> List of users and groups who are <strong>allowed</strong> to change the current topic. (More in [[Main/TWikiAccessControl]]) </td>
416   </tr>
417   <tr>
418     <td><code>%FINALPREFERENCES%</code></td>
419     <td><strong><em>SL</em></strong> , <strong><em>WL</em></strong></td>
420     <td> List of preferences that are not allowed to be overridden by next level preferences</td>
421   </tr>
422 </table>
423
424 **_Notes:_**
425
426 - Preferences variables ( on site-level, web-level and user level ) are defined by bullet lines with this syntax:
427   - `Set VARIABLENAME = value`
428 - Additional preferences variables can be defined on all three level as needed. Example:
429   - `Set MYLOGO = %PUBURLPATH%/%MAINWEB%/LogoTopic/logo.gif`
430
431 -- [[PeterThoeny]] - 25 Jun 2001 <br />