none
[openafs-wiki.git] / TWiki / TWikiVariables.mdwn
index 1d8c261..5a6e4a5 100644 (file)
@@ -3,6 +3,8 @@
     <li><a href="#TWiki Variables"> TWiki Variables</a><ul>
         <li><a href="#Predefined Variables"> Predefined Variables</a></li>
         <li><a href="#Preferences Variables"> Preferences Variables</a></li>
+        <li><a href="#Setting Variable Preferences"> Setting Variable Preferences</a></li>
+        <li><a href="#Creating Custom Variables"> Creating Custom Variables</a></li>
       </ul>
     </li>
   </ul>
@@ -10,6 +12,8 @@
 
 ## <a name="TWiki Variables"></a> TWiki Variables
 
+TWikiVariables are text strings enclosed in percentage signs: <code>**%VARIABLE%**</code> that represent stored data. When a topic is rendered for viewing, defined variables replaced by their actual values. TWiki has two types of variable, predefined, and Preference-based, where you can change settings. Through Preference variables, you can even define custom variables. Clearly, they are a power TWiki feature.
+
 ### <a name="Predefined Variables"></a> Predefined Variables
 
 %WIKITOOLNAME% expands the following variables enclosed in % percent signs:
@@ -33,7 +37,7 @@
   </tr>
   <tr>
     <td><code>%SCRIPTSUFFIX%</code></td>
-    <td> The script suffix, i.e. <code>.pl</code>, is <b></b></td>
+    <td> The script suffix, ex: <code>.pl</code>, <code>.cgi</code> is <b></b></td>
   </tr>
   <tr>
     <td><code>%PUBURL%</code></td>
@@ -53,7 +57,7 @@
   </tr>
   <tr>
     <td><code>%URLPARAM{"name"}%</code></td>
-    <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>
+    <td> Returns the value of a URL parameter. Ex: <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>%WIKITOOLNAME%</code></td>
   </tr>
   <tr>
     <td><code>%WIKIVERSION%</code></td>
-    <td> Wiki tool version, is <b>TWiki-4.1.2, Sat, 03 Mar 2007, build 13046</b></td>
+    <td> Wiki tool version is <b>TWiki-4.1.2, Sat, 03 Mar 2007, build 13046</b></td>
   </tr>
   <tr>
     <td><code>%USERNAME%</code></td>
-    <td> Your login username, is <b>admin</b></td>
+    <td> Your login username is <b>admin</b></td>
   </tr>
   <tr>
     <td><code>%WIKINAME%</code></td>
   </tr>
   <tr>
     <td><code>%TWIKIWEB%</code></td>
-    <td> The web containing all documentation and configuration of %WIKITOOLNAME%. Is <b>TWiki</b></td>
+    <td> The web containing all documentation and configuration of %WIKITOOLNAME% is <b>TWiki</b></td>
   </tr>
   <tr>
     <td><code>%WEB%</code></td>
-    <td> The current web, is <b>%WEB%</b></td>
+    <td> The current web is <b>%WEB%</b></td>
   </tr>
   <tr>
     <td><code>%BASEWEB%</code></td>
   </tr>
   <tr>
     <td><code>%GMTIME%</code></td>
-    <td> GM time, is <b>29 Jun 2010 - 15:27</b></td>
+    <td> GM time, is <b>29 Jun 2010 - 15:28</b></td>
   </tr>
   <tr>
     <td><code>%GMTIME{"format"}%</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:27:26</b></td>
+      </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:28:11</b></td>
   </tr>
   <tr>
     <td><code>%SERVERTIME%</code></td>
-    <td> Server time, is <b>29 Jun 2010 - 11:27</b></td>
+    <td> Server time, is <b>29 Jun 2010 - 11:28</b></td>
   </tr>
   <tr>
     <td><code>%SERVERTIME{"format"}%</code></td>
-    <td> Formatted server time. <br /> Example: <code>%SERVERTIME{"$hou:$min"}%</code> is <b>11:27</b></td>
+    <td> Formatted server time. <br /> Example: <code>%SERVERTIME{"$hou:$min"}%</code> is <b>11:28</b></td>
   </tr>
   <tr>
     <td><code>%HTTP_HOST%</code></td>
@@ -568,11 +572,14 @@ Additional variables are defined in the preferences ( site-level ( **_SL_** ) in
   </tr>
 </table>
 
-**_Notes:_**
+### <a name="Setting Variable Preferences"></a> Setting Variable Preferences
+
+- The syntax for Preferences variables is the same anywhere in TWiki. In Edit mode, from the start of a new line: <br />[6 spaces] \* [space] Set [space] VARIABLENAME [space] = [value] <br />**_Example:_**
+  - <code>**Set VARIABLENAME = value**</code>
+
+### <a name="Creating Custom Variables"></a> Creating Custom Variables
 
-- Preferences variables ( on site-level, web-level and user level ) are defined by bullet lines with this syntax:
-  - `Set VARIABLENAME = value`
-- Additional preferences variables can be defined on all three level as needed. Example:
-  - `Set MYLOGO = %PUBURLPATH%/%MAINWEB%/LogoTopic/logo.gif`
+- You can add your own preference variables for an entire site, a single web, or a single topic, using the standard syntax. Whatever you include in your variable will be expanded on display, and treated exactly as if it had been written out. So you can place formatted text, page links, image paths.<br />**_Example:_** To place a logo anywhere in a web by typing <code>**%MYLOGO%**</code>, define the variable in the web's [[WebPreferences]] topic, like this (in this case, you also have to upload <code>**logo.gif**</code> to the same directory):
+  - <code>**Set MYLOGO = %PUBURLPATH%/%MAINWEB%/LogoTopic/logo.gif**</code>
 
--- [[PeterThoeny]] - 23 Jul 2001 <br /> -- [[MikeMannix]] - 26 Aug 2001 <br />
+-- [[MikeMannix]] - 30 Aug 2001 <br />