none
[openafs-wiki.git] / TWiki / TWikiVariables.mdwn
index c212af3..8b51838 100644 (file)
@@ -16,6 +16,8 @@ _Special text strings expand on the fly to display user data or system info_
 
 TWikiVariables are text strings - `%VARIABLE%` - that expand into content whenever a page is opened. When a topic is rendered for viewing, `VARIABLES` are replaced by data, either user-entered, or info automatically generated by TWiki (like the date, or the current username). There are predefined variables, and Preference variables that you configure. You can also define custom variables, with new names and values.
 
+**_Note:_** To leave a variable unexpanded, preceed it with an exclamation point, e.g. type `!%TOPIC%` to get %TOPIC%.
+
 ## <a name="Predefined Variables"></a> Predefined Variables
 
 Most predefined variables return values that were either set in the <code>**lib/twiki.cfg**</code> file, when TWiki was installed, or taken from server info (like current username, or date and time). Many of the variables let you format the appearance of the display results.
@@ -24,7 +26,7 @@ Most predefined variables return values that were either set in the <code>**lib/
 
 This version of TWiki - TWiki-4.1.2, Sat, 03 Mar 2007, build 13046 - expands the following variables (enclosed in <code>**%**</code> percent signs):
 
-<table align="center" border="1" cellpadding="2" cellspacing="0" style="background-color: #f5f5f5" width="90%">
+<table align="center" border="1" cellpadding="2" cellspacing="0" style="background-color: #f5f5f5">
   <tr>
     <th width="160"> Variable: </th>
     <th> Expanded to: </th>
@@ -66,7 +68,7 @@ This version of TWiki - TWiki-4.1.2, Sat, 03 Mar 2007, build 13046 - expands the
     <td> Small 16x16 pixel icon of common attachment types, like <img align="top" alt="bmp" border="0" height="16" src="http://www.dementia.org/twiki//view/Main/WebHome/bmp.gif" width="16" /> <code>bmp</code>, <img align="top" alt="doc" border="0" height="16" src="http://www.dementia.org/twiki//view/Main/WebHome/doc.gif" width="16" /> <code>doc</code>, <img align="top" alt="gif" border="0" height="16" src="http://www.dementia.org/twiki//view/Main/WebHome/gif.gif" width="16" /> <code>gif</code>, <img align="top" alt="hlp" border="0" height="16" src="http://www.dementia.org/twiki//view/Main/WebHome/hlp.gif" width="16" /> <code>hlp</code>, <img align="top" alt="html" border="0" height="16" src="http://www.dementia.org/twiki//view/Main/WebHome/html.gif" width="16" /> <code>html</code>, <img align="top" alt="mp3" border="0" height="16" src="http://www.dementia.org/twiki//view/Main/WebHome/mp3.gif" width="16" /> <code>mp3</code>, <img align="top" alt="pdf" border="0" height="16" src="http://www.dementia.org/twiki//view/Main/WebHome/pdf.gif" width="16" /> <code>pdf</code>, <img align="top" alt="ppt" border="0" height="16" src="http://www.dementia.org/twiki//view/Main/WebHome/ppt.gif" width="16" /> <code>ppt</code>, <img align="top" alt="txt" border="0" height="16" src="http://www.dementia.org/twiki//view/Main/WebHome/txt.gif" width="16" /> <code>txt</code>, <img align="top" alt="xls" border="0" height="16" src="http://www.dementia.org/twiki//view/Main/WebHome/xls.gif" width="16" /> <code>xls</code>, <img align="top" alt="xml" border="0" height="16" src="http://www.dementia.org/twiki//view/Main/WebHome/xml.gif" width="16" /> <code>xml</code>, <img align="top" alt="zip" border="0" height="16" src="http://www.dementia.org/twiki//view/Main/WebHome/zip.gif" width="16" /> <code>zip</code>, etc. Specify file type only, file name, or full path name. Example: <code>%ICON{"pdf"}%</code> returns <img align="top" alt="pdf" border="0" height="16" src="http://www.dementia.org/twiki//view/Main/WebHome/pdf.gif" width="16" /></td>
   </tr>
   <tr>
-    <td><code>%PARAM{"name"}%</code></td>
+    <td><code>%URLPARAM{"name"}%</code></td>
     <td> Returns the value of a URL parameter. Note that there is a risk that this variable could be misused for cross-scripting. Supported parameters: <table border="1" cellpadding="0" cellspacing="0">
         <tr>
           <th bgcolor="#99CCCC"><strong> Parameter: </strong></th>
@@ -85,7 +87,7 @@ This version of TWiki - TWiki-4.1.2, Sat, 03 Mar 2007, build 13046 - expands the
         </tr>
         <tr>
           <td><code>newline="&lt;br /&gt;"</code></td>
-          <td> Convert newlines to other delimiters </td>
+          <td> Convert newlines in textarea to other delimiters </td>
           <td> no conversion </td>
         </tr>
         <tr>
@@ -98,7 +100,17 @@ This version of TWiki - TWiki-4.1.2, Sat, 03 Mar 2007, build 13046 - expands the
           <td> Encode special characters for URL parameter use, like a double quote into <code>%22</code></td>
           <td> no encoding </td>
         </tr>
-      </table> Example: <code>%PARAM{"skin"}%</code> returns <b>print</b> for a <code>.../view/%WEB%/%TOPIC%?skin=print</code> URL. Is <b>%PARAM{"skin"}%</b></td>
+        <tr>
+          <td><code>multiple="on"</code> %BR% <code>multiple="[[$item]]"</code></td>
+          <td> If set, gets all selected elements of a <code>&lt;select multiple="multiple"&gt;</code> tag. A format can be specified, with <code>$item</code> indicating the element, e.g. <code>multiple="Option: $item"</code></td>
+          <td> first element </td>
+        </tr>
+        <tr>
+          <td><code>separator=", "</code></td>
+          <td> Separator between multiple selections. Only relevant if multiple is specified </td>
+          <td><code>"\n"</code> (new line) </td>
+        </tr>
+      </table> Example: <code>%URLPARAM{"skin"}%</code> returns <b>print</b> for a <code>.../view/%WEB%/%TOPIC%?skin=print</code> URL. Is <b></b></td>
   </tr>
   <tr>
     <td><code>%ENCODE{"string"}%</code></td>
@@ -277,7 +289,7 @@ This version of TWiki - TWiki-4.1.2, Sat, 03 Mar 2007, build 13046 - expands the
   </tr>
   <tr>
     <td><code>%GMTIME%</code></td>
-    <td> GM time, is <b>29 Jun 2010 - 15:43</b></td>
+    <td> GM time, is <b>29 Jun 2010 - 15:45</b></td>
   </tr>
   <tr>
     <td><code>%GMTIME{"format"}%</code></td>
@@ -288,54 +300,87 @@ This version of TWiki - TWiki-4.1.2, Sat, 03 Mar 2007, build 13046 - expands the
           <th bgcolor="#99CCCC"><strong> Example </strong></th>
         </tr>
         <tr>
-          <td> $seconds </td>
+          <td><code>$seconds</code></td>
           <td> seconds </td>
           <td> 59 </td>
         </tr>
         <tr>
-          <td> $minutes </td>
+          <td><code>$minutes</code></td>
           <td> minutes </td>
           <td> 59 </td>
         </tr>
         <tr>
-          <td> $hours </td>
+          <td><code>$hours</code></td>
           <td> hours </td>
           <td> 23 </td>
         </tr>
         <tr>
-          <td> $day </td>
+          <td><code>$day</code></td>
           <td> day of month </td>
           <td> 31 </td>
         </tr>
         <tr>
-          <td> $month </td>
+          <td><code>$wday</code></td>
+          <td> day of the Week (Sun, Mon, Tue, Wed, Thu, Fri, Sat) </td>
+          <td> Thu </td>
+        </tr>
+        <tr>
+          <td><code>$month</code></td>
           <td> month in ISO format </td>
           <td> Dec </td>
         </tr>
         <tr>
-          <td> $mo </td>
+          <td><code>$mo</code></td>
           <td> 2 digit month </td>
           <td> 12 </td>
         </tr>
         <tr>
-          <td> $year </td>
+          <td><code>$year</code></td>
           <td> 4 digit year </td>
           <td> 1999 </td>
         </tr>
         <tr>
-          <td> $ye </td>
+          <td><code>$ye</code></td>
           <td> 2 digit year </td>
           <td> 99 </td>
         </tr>
-      </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:43:51</b></td>
+        <tr>
+          <td><code>$tz</code></td>
+          <td> either "GMT" (if set to gmtime), or "Local" (if set to servertime) </td>
+          <td> GMT </td>
+        </tr>
+        <tr>
+          <td><code>$iso</code></td>
+          <td> ISO format timestamp </td>
+          <td> 2010-06-29T15:45:07Z </td>
+        </tr>
+        <tr>
+          <td><code>$rcs</code></td>
+          <td> RCS format timestamp </td>
+          <td> 2010/06/29 15:45:07 </td>
+        </tr>
+        <tr>
+          <td><code>$http</code></td>
+          <td> E-mail &amp; http format timestamp </td>
+          <td> Tue, 29 Jun 2010 15:45:07 GMT </td>
+        </tr>
+      </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:45:07</b></td>
   </tr>
   <tr>
     <td><code>%SERVERTIME%</code></td>
-    <td> Server time, is <b>29 Jun 2010 - 11:43</b></td>
+    <td> Server time, is <b>29 Jun 2010 - 11:45</b></td>
   </tr>
   <tr>
     <td><code>%SERVERTIME{"format"}%</code></td>
-    <td> Formatted server time. <br /> Example: <code>%SERVERTIME{"$hou:$min"}%</code> is <b>11:43</b></td>
+    <td> Formatted server time. Same format qualifiers as <code>%GMTIME%</code><br /> Example: <code>%SERVERTIME{"$hou:$min"}%</code> is <b>11:45</b></td>
+  </tr>
+  <tr>
+    <td><code>%DISPLAYTIME%</code></td>
+    <td> Display time, is <b>29 Jun 2010 - 15:45</b></td>
+  </tr>
+  <tr>
+    <td><code>%DISPLAYTIME{"format"}%</code></td>
+    <td> Formatted time - either GMT or Local server time, depending on setting in TWiki.cfg. Same format qualifiers as <code>%GMTIME%</code><br /> Example: <code>%DISPLAYTIME{"$hou:$min"}%</code> is <b>15:45</b></td>
   </tr>
   <tr>
     <td><code>%HTTP_HOST%</code></td>
@@ -389,7 +434,7 @@ This version of TWiki - TWiki-4.1.2, Sat, 03 Mar 2007, build 13046 - expands the
         <tr>
           <td><code>warn="off"</code></td>
           <td> Warn if topic include fails: Fail silently (if <code>off</code>); output default warning (if set to <code>on</code>); else, output specific text (use <code>$topic</code> for topic name) </td>
-          <td><code>%INCLUDE- WARNING%</code> preferences setting </td>
+          <td><code>%INCLUDE- WARNING%</code> [[Main/TWikiPreferences]] setting </td>
         </tr>
       </table>
     </td>
@@ -446,7 +491,7 @@ This version of TWiki - TWiki-4.1.2, Sat, 03 Mar 2007, build 13046 - expands the
         </tr>
         <tr>
           <td><code>"text"</code></td>
-          <td> Search term. Is a regular expression or literal, depending on the <code>regex</code> parameter. For regular expressions ";" is used to mean <em>and</em> e.g. "search;agrep" will find all topic containing search <em>and</em> agrep. </td>
+          <td> Search term. Is a keyword search, literal search or regular expression search, depending on the <code>type</code> parameter. [[Main/SearchHelp]] has more </td>
           <td> required </td>
         </tr>
         <tr>
@@ -470,26 +515,26 @@ This version of TWiki - TWiki-4.1.2, Sat, 03 Mar 2007, build 13046 - expands the
           <td> None </td>
         </tr>
         <tr>
-          <td><code>scope="topic"</code><br /><code>scope="text"</code></td>
-          <td> Search topic name (title) or in the text (body) of the topic </td>
-          <td> Topic text (body) </td>
+          <td><code>type="keyword"</code><br /><code>type="literal"</code><br /><code>type="regex"</code></td>
+          <td> Do a keyword search like <code>soap "web service" -shampoo</code>; a literal search like <code>web service</code>; or [[Main/RegularExpression]] search like <code>soap;web service;!shampoo</code></td>
+          <td><code>%SEARCHVAR- DEFAULTTYPE%</code> [[Main/TWikiPreferences]] setting </td>
+        </tr>
+        <tr>
+          <td><code>scope="topic"</code><br /><code>scope="text"</code><br /><code>scope="all"</code></td>
+          <td> Search topic name (title); the text (body) of topic; or all (both) </td>
+          <td><code>"text"</code></td>
         </tr>
         <tr>
-          <td><code>order="topic"</code><br /><code>order="modified"</code><br /><code>order="editby"</code><br /><code>order=<br /> "formfield(name)"</code></td>
-          <td> Sort the results of search by the topic names, last modified time, last editor, or named field of [[Main/TWikiForms]]</td>
+          <td><code>order="topic"</code><br /><code>order="created"</code><br /><code>order="modified"</code><br /><code>order="editby"</code><br /><code>order=<br /> "formfield(name)"</code></td>
+          <td> Sort the results of search by the topic names, topic creation time, last modified time, last editor, or named field of [[Main/TWikiForms]]. The sorting is done web by web; in case you want to sort across webs, create a [[Main/FormattedSearch]] table and sort it with [[Main/TablePlugin]]'s initsort </td>
           <td> Sort by topic name </td>
         </tr>
         <tr>
           <td><code>limit="all"</code><br /><code>limit="16"</code></td>
-          <td> Limit the number of results returned </td>
+          <td> Limit the number of results returned. This is done after sorting in case <code>order</code> is specified </td>
           <td> All results </td>
         </tr>
         <tr>
-          <td><code>regex="on"</code></td>
-          <td>[[Main/RegularExpression]] search; also enables ";" as <em>and</em></td>
-          <td> Literal search </td>
-        </tr>
-        <tr>
           <td><code>reverse="on"</code></td>
           <td> Reverse the direction of the search </td>
           <td> Ascending search </td>
@@ -530,6 +575,11 @@ This version of TWiki - TWiki-4.1.2, Sat, 03 Mar 2007, build 13046 - expands the
           <td> Results in table </td>
         </tr>
         <tr>
+          <td><code>expandvariables="on"</code></td>
+          <td> Expand variables before applying a [[Main/FormattedSearch]] on a search hit. Useful to show the expanded text, e.g. to show the result of a [[Main/SpreadSheetPlugin]] <code>%CALC{}%</code> instead of the formula </td>
+          <td> Raw text </td>
+        </tr>
+        <tr>
           <td><code>multiple="on"</code></td>
           <td> Multiple hits per topic. Each hit can be [[Main/FormattedSearch]]. The last token is used in case of a regular expression ";" <em>and</em> search </td>
           <td> Only one hit per topic </td>
@@ -539,7 +589,7 @@ This version of TWiki - TWiki-4.1.2, Sat, 03 Mar 2007, build 13046 - expands the
           <td> Line separator between hits </td>
           <td> Newline <code>"$n"</code></td>
         </tr>
-      </table> Regular example: <code><b>%SEARCH{"wiki" web="Main" scope="topic"}%</b></code><br /> Formatted example: <code><b>%SEARCH{"FAQ" scope="topic" nosearch="on" nototal="on" header="| *Topic: * | *Summary: * |" format="| $topic | $summary |"%</b></code> <em>(displays results in a table with header - [[Main/FormattedSearch]])</em><br /> %H% If the TWiki:Plugins.TablePlugin is installed, you may set a <code>%TABLE{}%</code> variable just before the <code>%SEARCH{}%</code> to alter the output of a search. Example: <code><b>%TABLE{ tablewidth="90%" }%</b></code></td>
+      </table> Example: <code><b>%SEARCH{"wiki" web="Main" scope="topic"}%</b></code><br /> Formatted example: <code><b>%SEARCH{"FAQ" scope="topic" nosearch="on" nototal="on" header="| *Topic: * | *Summary: * |" format="| $topic | $summary |"%</b></code> <em>(displays results in a table with header - [[Main/FormattedSearch]])</em><br /> %H% If the TWiki:Plugins.TablePlugin is installed, you may set a <code>%TABLE{}%</code> variable just before the <code>%SEARCH{}%</code> to alter the output of a search. Example: <code><b>%TABLE{ tablewidth="90%" }%</b></code></td>
   </tr>
   <tr>
     <td><code>%METASEARCH{...}%</code></td>
@@ -591,7 +641,7 @@ This version of TWiki - TWiki-4.1.2, Sat, 03 Mar 2007, build 13046 - expands the
 
 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):
 
-<table align="center" border="1" cellpadding="2" cellspacing="0" style="background-color: #f5f5f5" width="90%">
+<table align="center" border="1" cellpadding="2" cellspacing="0" style="background-color: #f5f5f5">
   <tr>
     <th width="160"> Variable: </th>
     <th> Level: </th>
@@ -723,35 +773,13 @@ Additional variables are defined in the preferences ( site-level ( **_SL_** ) in
     <td> List of users and groups who are <strong>allowed</strong> to rename the current topic. (More in [[Main/TWikiAccessControl]]) </td>
   </tr>
   <tr>
-    <td>
-      <p>
-      </p>
-    </td>
     <td><code>%FINALPREFERENCES%</code></td>
     <td><strong><em>SL</em></strong> , <strong><em>WL</em></strong></td>
     <td> List of preferences that are not allowed to be overridden by next level preferences</td>
   </tr>
 </table>
 
-> **_Note:_**
->
-> There are some more useful variables defined in the
->
-> [[TWikiPreferences]]
->
-> like
->
-> `%BR%`
->
-> for line break, colors like
->
-> `%RED%`
->
-> for colored text and small icons like
->
-> `%H%`
->
-> for a %H% Help icon.
+**_Note:_** There are some more useful variables defined in the [[TWikiPreferences]] like `%BR%` for line break, colors like `%RED%` for colored text and small icons like `%H%` for a %H% Help icon.
 
 <a name="SettingPrefs"></a>
 
@@ -772,4 +800,4 @@ Additional variables are defined in the preferences ( site-level ( **_SL_** ) in
 > - To place a logo anywhere in a web by typing <code>**%MYLOGO%**</code>, define the Variable on the web's [[WebPreferences]] page, and upload a logo file, ex: `mylogo.gif`. You can upload by [[attaching the file|Main/FileAttachment]] to [[WebPreferences]], or, to avoid clutter, to any other topic in the same web, ex: `LogoTopic`:
 >   - <code>**Set MYLOGO = %PUBURL%/TWiki/LogoTopic/mylogo.gif**</code>
 
--- TWiki:Main.PeterThoeny - 14 Jan 2004 <br /> -- TWiki:Main.MikeMannix - 12 May 2002
+-- TWiki:Main.PeterThoeny - 16 Mar 2004 <br /> -- TWiki:Main.MikeMannix - 12 May 2002