<div>
<ul>
<li><a href="#TWiki Variables"> TWiki Variables</a><ul>
+ <li><a href="#Overview"> Overview</a></li>
<li><a href="#Predefined Variables"> Predefined Variables</a></li>
<li><a href="#Preferences Variables"> Preferences Variables</a></li>
<li><a href="#Setting Preferences"> Setting Preferences</a></li>
</ul>
</div>
-## <a name="TWiki Variables"></a> TWiki Variables
+# <a name="TWiki Variables"></a> TWiki Variables
+
+_Text strings expanded on the fly include predefined, preference-driven and custom-defined data_
+
+## <a name="Overview"></a> Overview
TWikiVariables are text strings enclosed in percentage signs: <code>**%VARIABLE%**</code> that represent stored data. When a topic is rendered for viewing, defined variables are replaced by their actual values. TWiki has two types of variable, predefined and Preference-based, where usually you determine the content. Through Preference variables, you can also define custom variables, creating new variable name and value. TWiki variables are as simple to use as they are powerful, and vice versa!
-### <a name="Predefined Variables"></a> Predefined Variables
+## <a name="Predefined Variables"></a> Predefined Variables
With a couple of notable exceptions, predefined variables return set values that are defined one-time on installation and left alone. Most are directory names and file paths, customized for your server, and only have to be updated once in the main configuration file if your server set-up changes.
<td><code>"selected"</code></td>
</tr>
<tr>
- <td><code>selection</code></td>
- <td> Current value e.g. current for current Web, =section="%WEB%" </td>
+ <td><code>selection="%WEB%"</code></td>
+ <td> Current value to be selected in list </td>
+ <td><code>section="%WEB%"</code></td>
</tr>
</table> Examples: <br /><code>%WEBLIST{" * [[$name.WebHome]]"}%</code> creates a bullet list of all webs. <br /><code>%WEBLIST{"<select><option $marker="$marker" value="$qname">$name</option>" webs="Trash,public" selection="%WEB%" separator=" "}%</select></code> Dropdown of all public Webs + Trash Web, current Web highlighted. </td>
</tr>
<tr>
<td><code>%GMTIME%</code></td>
- <td> GM time, is <b>29 Jun 2010 - 15:28</b></td>
+ <td> GM time, is <b>29 Jun 2010 - 15:30</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:28:27</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:30:15</b></td>
</tr>
<tr>
<td><code>%SERVERTIME%</code></td>
- <td> Server time, is <b>29 Jun 2010 - 11:28</b></td>
+ <td> Server time, is <b>29 Jun 2010 - 11:30</b></td>
</tr>
<tr>
<td><code>%SERVERTIME{"format"}%</code></td>
- <td> Formatted server time. <br /> Example: <code>%SERVERTIME{"$hou:$min"}%</code> is <b>11:28</b></td>
+ <td> Formatted server time. <br /> Example: <code>%SERVERTIME{"$hou:$min"}%</code> is <b>11:30</b></td>
</tr>
<tr>
<td><code>%HTTP_HOST%</code></td>
</table> Example: <code><b>%SEARCH{"wiki" web="Main" scope="topic"}%</b></code></td>
</tr>
<tr>
+ <td><code>%METASEARCH{...}%</code></td>
+ <td> Special search of meta data <table border="1" cellpadding="0" cellspacing="0">
+ <tr>
+ <th bgcolor="#99CCCC"><strong> Parameter: </strong></th>
+ <th bgcolor="#99CCCC"><strong> Description: </strong></th>
+ <th bgcolor="#99CCCC"><strong> Default: </strong></th>
+ </tr>
+ <tr>
+ <td><code>type="topicmoved"</code></td>
+ <td> What sort of search is required? <br /><code>"topicmoved"</code> if search for a topic that may have been moved <br /><code>"parent"</code> if searcing for topics that have a specific parent i.e. its children </td>
+ <td> required </td>
+ </tr>
+ <tr>
+ <td><code>web="%WEB%"</code></td>
+ <td> Wiki web to search: A web, a list of webs separated by whitespace, or <code>all</code> webs. </td>
+ <td> required </td>
+ </tr>
+ <tr>
+ <td><code>topic="%TOPIC%"</code></td>
+ <td> The topic the search relates to </td>
+ <td> required </td>
+ </tr>
+ <tr>
+ <td><code>title="Title"</code></td>
+ <td> Text the is pre-pended to any search results </td>
+ <td> required </td>
+ </tr>
+ </table> Example: <code><b>%METASEARCH{type="topicmoved" web="%WEB%" topic="%TOPIC%" title="This topic used to exist and was moved to: "}%</b></code>, you may want to use this in [[Main/WebTopicViewTemplate]] and [[Main/WebTopicNonWikiTemplate]]<br /><code><b>%METASEARCH{type="parent" web="%WEB%" topic="%TOPIC%" title="Children: "}%</b></code></td>
+ </tr>
+ <tr>
<td><code>%VAR{"NAME" web="Web"}%</code></td>
<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>
</tr></font></font></table>
>
> [2] **_Note_**: A web can be excluded from a `web="all"` search if you define a `NOSEARCHALL=on` variable in its [[WebPreferences]].
-### <a name="Preferences Variables"></a> Preferences Variables
+## <a name="Preferences Variables"></a> Preferences Variables
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):
<td> List of preferences that are not allowed to be overridden by next level preferences</td>
</tr></font></font></table>
-### <a name="Setting Preferences"></a> Setting Preferences
+## <a name="Setting Preferences"></a> Setting 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
+## <a name="Creating Custom Variables"></a> Creating Custom Variables
- 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.
-> <span><font>**HOW-TO: Create a custom logo variable**</font></span>
+> **Example: Create a custom logo variable**
>
> <br />
>
-> To place a logo anywhere in a web by typing
->
-> <code>**%MYLOGO%**</code>
->
-> , simply define the variable on the web's
->
-> [[WebPreferences]]
->
-> page. 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>
+> - To place a logo anywhere in a web by typing <code>**%MYLOGO%**</code>, simply define the variable on the web's [[WebPreferences]] page. You also have to upload `logo.gif` - this can be done by [[attaching a file|Main/FileAttachment]] to `LogoTopic` (any topic name you choose):
+> - <code>**Set MYLOGO = %PUBURLPATH%/%MAINWEB%/LogoTopic/logo.gif**</code>
-- [[MikeMannix]] - 30 Aug 2001 <br />