1 ## <a name="TWiki Variables"></a> TWiki Variables
3 ### <a name="Predefined Variables"></a> Predefined Variables
5 %WIKITOOLNAME% expands the following variables enclosed in % percent signs:
10 <th> Expanded to: </th>
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>
17 <td><code>%SCRIPTURL%</code></td>
18 <td> The script URL of %WIKITOOLNAME%, is <b>http://www.dementia.org/twiki/</b></td>
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>
25 <td><code>%SCRIPTSUFFIX%</code></td>
26 <td> The script suffix, i.e. <code>.pl</code>, is <b></b></td>
29 <td><code>%PUBURL%</code></td>
30 <td> The public URL of TWiki, is <b>http://www.dementia.org/twiki//view</b></td>
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>
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>
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>
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>
49 <td><code>%WIKITOOLNAME%</code></td>
50 <td> Name of wiki tool, is <b>%WIKITOOLNAME%</b></td>
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>
57 <td><code>%USERNAME%</code></td>
58 <td> Your login username, is <b>admin</b></td>
61 <td><code>%WIKINAME%</code></td>
62 <td> Your Wiki username. Same as %USERNAME% if not defined in the [[Main/TWikiUsers]] topic. Is <b>admin</b></td>
65 <td><code>%WIKIUSERNAME%</code></td>
66 <td> Your %WIKINAME% including the Main web name. Usefull for signatures. Is <b>Main.admin</b></td>
69 <td><code>%WEB%</code></td>
70 <td> The current web, is <b>%WEB%</b></td>
73 <td><code>%BASEWEB%</code></td>
74 <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>
77 <td><code>%INCLUDINGWEB%</code></td>
78 <td> The web name of the topic that includes the current topic. Same as <code>%WEB%</code> in case there is no include. </td>
81 <td><code>%TOPIC%</code></td>
82 <td> The current topic name, is <b>%TOPIC%</b></td>
85 <td><code>%BASETOPIC%</code></td>
86 <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>
89 <td><code>%INCLUDINGTOPIC%</code></td>
90 <td> The name of the topic that includes the current topic. Same as <code>%TOPIC%</code> in case there is no include. </td>
93 <td><code>%SPACEDTOPIC%</code></td>
94 <td> The current topic name with added spaces, for regular expression search of Ref-By, is <b></b></td>
97 <td><code>%TOPICLIST{"format"}%</code></td>
98 <td> Topic index of a web. The "format" defines the format of one topic item. It may include variables: The <code>$name</code> variable gets expanded to the topic name; the <code>$web</code> variable gets expanded to the name of the web. Parameters are format, separator and web: <table border="1" cellpadding="0" cellspacing="0">
100 <th bgcolor="#99CCCC"><strong> Parameter: </strong></th>
101 <th bgcolor="#99CCCC"><strong> Description: </strong></th>
102 <th bgcolor="#99CCCC"><strong> Default: </strong></th>
105 <td><code>"format"</code></td>
106 <td> Format of one line, may include <code>$name</code> and <code>$web</code> variables </td>
107 <td><code>"$name"</code></td>
110 <td><code>format="format"</code></td>
111 <td> (Alternative to above) </td>
112 <td><code>"$name"</code></td>
115 <td><code>separator=", "</code></td>
116 <td> line separator </td>
117 <td><code>"\n"</code> (new line) </td>
120 <td><code>web="Name"</code></td>
121 <td> Name of web </td>
122 <td> Current web </td>
124 </table> Examples: <br /><code>%TOPICLIST{" * $web.$name"}%</code> creates a bullet list of all topics. <br /><code>%TOPICLIST{separator=", "}%</code> creates a comma separated list of all topics. <br /><code>%TOPICLIST{" <option>$name</option>"}%</code> creates an option list (for drop down menus). </td>
127 <td><code>%WEBLIST{"format"}%</code></td>
128 <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 gets expanded to the name of the web. Parameters are format, separator and web: <table border="1" cellpadding="0" cellspacing="0">
130 <th bgcolor="#99CCCC"><strong> Parameter: </strong></th>
131 <th bgcolor="#99CCCC"><strong> Description: </strong></th>
132 <th bgcolor="#99CCCC"><strong> Default: </strong></th>
135 <td><code>"format"</code></td>
136 <td> Format of one line, may include <code>$name</code> variable </td>
137 <td><code>"$name"</code></td>
140 <td><code>format="format"</code></td>
141 <td> (Alternative to above) </td>
142 <td><code>"$name"</code></td>
145 <td><code>separator=", "</code></td>
146 <td> line separator </td>
147 <td><code>"\n"</code> (new line) </td>
149 </table> Example: <br /><code>%WEBLIST{" * [[$name.WebHome]]"}%</code> creates a bullet list of all webs. </td>
152 <td><code>%GMTIME%</code></td>
153 <td> GM time, is <b>29 Jun 2010 - 15:26</b></td>
156 <td><code>%GMTIME{"format"}%</code></td>
157 <td> Formatted GM time based on time variables. <table border="1" cellpadding="0" cellspacing="0">
159 <th bgcolor="#99CCCC"><strong> Variable: </strong></th>
160 <th bgcolor="#99CCCC"><strong> Unit: </strong></th>
161 <th bgcolor="#99CCCC"><strong> Example </strong></th>
180 <td> day of month </td>
185 <td> month in ISO format </td>
190 <td> 2 digit month </td>
195 <td> 4 digit year </td>
200 <td> 2 digit year </td>
203 </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:48</b></td>
206 <td><code>%SERVERTIME%</code></td>
207 <td> Server time, is <b>29 Jun 2010 - 11:26</b></td>
210 <td><code>%SERVERTIME{"format"}%</code></td>
211 <td> Formatted server time. <br /> Example: <code>%SERVERTIME{"$hou:$min"}%</code> is <b>11:26</b></td>
214 <td><code>%HTTP_HOST%</code></td>
215 <td> HTTP_HOST environment variable, is <b></b></td>
218 <td><code>%REMOTE_ADDR%</code></td>
219 <td> REMOTE_ADDR environment variable, is <b></b></td>
222 <td><code>%REMOTE_PORT%</code></td>
223 <td> REMOTE_PORT environment variable, is <b></b></td>
226 <td><code>%REMOTE_USER%</code></td>
227 <td> REMOTE_USER environment variable, is <b></b></td>
230 <td><code>%INCLUDE{"page" ...}%</code></td>
231 <td> Server side include to [[Main/IncludeTopicsAndWebPages]]. Parameters are page name, and an optional <code>pattern="(reg-exp)"</code>. The page name is: <table border="1" cellpadding="0" cellspacing="0">
233 <td><code>"SomeTopic"</code></td>
234 <td> The name of a topic located in the current web, i.e. <code>%INCLUDE{"WebNotify"}%</code></td>
237 <td><code>"Web.Topic"</code></td>
238 <td> A topic in another web, i.e. <code>%INCLUDE{"TWiki.TWikiWebsTable"}%</code></td>
241 <td><code>"http://..."</code></td>
242 <td> A full qualified URL, i.e. <code>%INCLUDE{"http://twiki.org/"}%</code></td>
248 <td><code>%STARTINCLUDE%</code></td>
249 <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>
252 <td><code>%STOPINCLUDE%</code></td>
253 <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>
256 <td><code>%TOC%</code></td>
257 <td> Table of Content of current topic. </td>
260 <td><code>%TOC{"SomeTopic" ...}%</code></td>
261 <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>"<h2>text<h2>"</code>) are taken into account. Parameters are topic name, web and depth: <table border="1" cellpadding="0" cellspacing="0">
263 <th bgcolor="#99CCCC"><strong> Parameter: </strong></th>
264 <th bgcolor="#99CCCC"><strong> Description: </strong></th>
265 <th bgcolor="#99CCCC"><strong> Default: </strong></th>
268 <td><code>"TopicName"</code></td>
269 <td> topic name </td>
270 <td> Current topic </td>
273 <td><code>web="Name"</code></td>
274 <td> Name of web </td>
275 <td> Current web </td>
278 <td><code>depth="2"</code></td>
279 <td> Limit depth of headings shown in TOC </td>
282 </table> Examples: <code><b>%TOC{depth="2"}%</b></code>, <code><b>%TOC{"TWikiDocumentation" web="TWiki"}%</b></code></td>
285 <td><code>%SEARCH{"text" ...}%</code></td>
286 <td> Inline search, shows a search result embedded in a topic. Parameters are the search term, web, scope, order and many more: [1] <table border="1" cellpadding="0" cellspacing="0">
288 <th bgcolor="#99CCCC"><strong> Parameter: </strong></th>
289 <th bgcolor="#99CCCC"><strong> Description: </strong></th>
290 <th bgcolor="#99CCCC"><strong> Default: </strong></th>
293 <td><code>"text"</code></td>
294 <td> Search term. (Is a regular expression or literal, depending on the <code>regex</code> parameter) </td>
298 <td><code>search="text"</code></td>
299 <td> (Alternative to above) </td>
303 <td><code>web="Name"</code><br /><code>web="Main Know"</code><br /><code>web="all"</code></td>
304 <td> Wiki web to search: A web, a list of webs separated by whitespace, or <code>all</code> webs. [2] </td>
305 <td> Current web </td>
308 <td><code>scope="topic"</code><br /><code>scope="text"</code></td>
309 <td> Search topic name (title) or in the text (body) of the topic </td>
310 <td> Topic text (body) </td>
313 <td><code>order="topic"</code><br /><code>order="modified"</code><br /><code>order="editby"</code></td>
314 <td> Sort the results of search by the topic names, last modified time, or last editor </td>
315 <td> Sort by topic name </td>
318 <td><code>limit="all"</code><br /><code>limit="16"</code></td>
319 <td> Limit the number of results returned </td>
320 <td> All results </td>
323 <td><code>regex="on"</code></td>
324 <td>[[Main/RegularExpression]] search </td>
325 <td> Literal search </td>
328 <td><code>reverse="on"</code></td>
329 <td> Reverse the direction of the search </td>
330 <td> Ascending search </td>
333 <td><code>casesensitive="on"</code></td>
334 <td> Case sensitive search </td>
335 <td> Ignore case </td>
338 <td><code>nosummary="on"</code></td>
339 <td> Show topic title only </td>
340 <td> Show topic summary </td>
343 <td><code>bookview="on"</code></td>
344 <td>[[Main/BookView]] search, e.g. show complete topic text </td>
345 <td> Show topic summary </td>
348 <td><code>nosearch="on"</code></td>
349 <td> Suppress search string </td>
350 <td> Show search string </td>
353 <td><code>noheader="on"</code></td>
354 <td> Suppress search header <br /><span style="background: #FFB0B0"> <strong>Topics: Changed: By:</strong> </span></td>
355 <td> Show search header </td>
358 <td><code>nototal="on"</code></td>
359 <td> Do not show number of topics found </td>
360 <td> Show number </td>
362 </table> Example: <code><b>%SEARCH{"wiki" web="Main" scope="topic"}%</b></code></td>
365 <td><code>%VAR{"NAME" web="Web"}%</code></td>
366 <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>
374 [1] **_Note_**: The search form uses identical names for input fields.
376 [2] **_Note_**: A web can be excluded from a `web="all"` search if you define a `NOSEARCHALL=on` variable in its [[WebPreferences]].
378 ### <a name="Preferences Variables"></a> Preferences Variables
380 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):
389 <td><code>%WIKIWEBMASTER%</code></td>
390 <td><strong><em>SL</em></strong></td>
391 <td> Webmaster email address (sender of email notifications) , is <b></b></td>
394 <td><code>%WIKIWEBLIST%</code></td>
395 <td><strong><em>SL</em></strong></td>
396 <td> List of %WIKITOOLNAME% webs (in upper right corner of topics) </td>
399 <td><code>%WEBTOPICLIST%</code></td>
400 <td><strong><em>WL</em></strong></td>
401 <td> Common links of web (second line of topics) </td>
404 <td><code>%WEBCOPYRIGHT%</code></td>
405 <td><strong><em>SL</em></strong> , <strong><em>WL</em></strong></td>
406 <td> Copyright notice (bottom right corner of topics) </td>
409 <td><code>%WEBBGCOLOR%</code></td>
410 <td><strong><em>WL</em></strong></td>
411 <td> Background color of web </td>
414 <td><code>%NOSEARCHALL%</code></td>
415 <td><strong><em>WL</em></strong></td>
416 <td> Exclude web from a <code>web="all"</code> search (set variable to <code>on</code> for hidden webs) </td>
419 <td><code>%NEWTOPICBGCOLOR%</code></td>
420 <td><strong><em>SL</em></strong> , <em>UL</em></td>
421 <td> Background color of non existing topic. ( <strong><em>UL</em></strong> needs authentication for topic views ) </td>
424 <td><code>%NEWTOPICFONTCOLOR%</code></td>
425 <td><strong><em>SL</em></strong> , <em>UL</em></td>
426 <td> Font color of non existing topic. ( <strong><em>UL</em></strong> needs authentication for topic views ) </td>
429 <td><code>%EDITBOXWIDTH%</code></td>
430 <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
431 <td> Horizontal size of edit box, is <b> <code>%EDITBOXWIDTH%</code> </b></td>
434 <td><code>%EDITBOXHEIGHT%</code></td>
435 <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
436 <td> Vertical size of edit box, is <b> <code>%EDITBOXHEIGHT%</code> </b></td>
439 <td><code>%RELEASEEDITLOCKCHECKBOX%</code></td>
440 <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
441 <td> Default state of the "Release edit lock" ([[Main/UnlockTopic]]) check box in preview. Checkbox is initially checked if <code>Set RELEASEEDITLOCKCHECKBOX = checked="checked"</code>, or unchecked if empty. If checked, make sure to click on <u>Edit</u> to do more changes; do <strong>not</strong> go back in your browser to the edit page, or you risk that someone else will edit the topic at the same time! Value is: <b><code>%RELEASEEDITLOCKCHECKBOX%</code></b></td>
444 <td><code>%DONTNOTIFYCHECKBOX%</code></td>
445 <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
446 <td> Default state of the "Minor Changes, Don't Notify" ([[Main/DontNotify]]) check box in preview. Check box is initially checked if <code>Set DONTNOTIFYCHECKBOX = checked="checked"</code>, or unchecked if empty. Value is: <b><code>%DONTNOTIFYCHECKBOX%</code></b></td>
449 <td><code>%ATTACHLINKBOX%</code></td>
450 <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
451 <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>
454 <td><code>%HTTP_EQUIV_ON_VIEW%</code></td>
455 <td><strong><em>SL</em></strong></td>
456 <td> http-equiv meta tags for view, rdiff, attach, search* scripts. </td>
459 <td><code>%HTTP_EQUIV_ON_EDIT%</code></td>
460 <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
461 <td> http-equiv meta tags for edit script. </td>
464 <td><code>%HTTP_EQUIV_ON_PREVIEW%</code></td>
465 <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
466 <td> http-equiv meta tags for preview script. </td>
469 <td><code>%DENYWEBCHANGE%</code></td>
470 <td><strong><em>WL</em></strong></td>
471 <td> List of users and groups who are <strong>not allowed</strong> to change topics in the %WIKITOOLNAME% web. (More in [[Main/TWikiAccessControl]]) </td>
474 <td><code>%ALLOWWEBCHANGE%</code></td>
475 <td><strong><em>WL</em></strong></td>
476 <td> List of users and groups who are <strong>allowed</strong> to change topics in the %WIKITOOLNAME% web. (More in [[Main/TWikiAccessControl]]) </td>
479 <td><code>%DENYTOPICCHANGE%</code></td>
480 <td><strong><em>(any topic)</em></strong></td>
481 <td> List of users and groups who are <strong>not allowed</strong> to change the current topic. (More in [[Main/TWikiAccessControl]]) </td>
484 <td><code>%ALLOWTOPICCHANGE%</code></td>
485 <td><strong><em>(any topic)</em></strong></td>
486 <td> List of users and groups who are <strong>allowed</strong> to change the current topic. (More in [[Main/TWikiAccessControl]]) </td>
489 <td><code>%FINALPREFERENCES%</code></td>
490 <td><strong><em>SL</em></strong> , <strong><em>WL</em></strong></td>
491 <td> List of preferences that are not allowed to be overridden by next level preferences</td>
497 - Preferences variables ( on site-level, web-level and user level ) are defined by bullet lines with this syntax:
498 - `Set VARIABLENAME = value`
499 - Additional preferences variables can be defined on all three level as needed. Example:
500 - `Set MYLOGO = %PUBURLPATH%/%MAINWEB%/LogoTopic/logo.gif`
502 -- [[PeterThoeny]] - 14 Jul 2001 <br />