|
TWiki Variables |
|
< < | TWikiVariables are text strings enclosed in percentage signs: %VARIABLE% 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. |
> > | TWikiVariables are text strings enclosed in percentage signs: %VARIABLE% 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! |
|
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. |
| TWiki expands the following variables enclosed in % percent signs: |
|
< < | |
> > | |
|
%WIKIHOMEURL% |
The base script URL of TWiki, is the link of the Home icon in the upper left corner, is /bin/view |
|
|
%VAR{"NAME" web="Web"}% |
Get a preference value from a web other then the current one. Example: To get %WEBBGCOLOR% of the Main web write %VAR{"WEBBGCOLOR" web="Main"}% , is #FFEFA6 |
|
|
< < | |
| |
|
> > | |
| [1] Note: The search form uses identical names for input fields.
[2] Note: A web can be excluded from a web="all" search if you define a NOSEARCHALL=on variable in its WebPreferences. |
|
> > | |
|
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): |
|
< < | |
> > | |
| |
| SL , WL |
List of preferences that are not allowed to be overridden by next level preferences |
|
|
< < | Setting Variable Preferences |
> > |
Setting Preferences |
|
- The syntax for Preferences variables is the same anywhere in TWiki. In Edit mode, from the start of a new line:
[6 spaces] * [space] Set [space] VARIABLENAME [space] = [value] Example:
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.
Example: To place a logo anywhere in a web by typing %MYLOGO% , define the variable in the web's WebPreferences topic, like this (in this case, you also have to upload logo.gif to the same directory):
|
> > |
- 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.
HOW-TO: Create a custom logo variable
To place a logo anywhere in a web by typing %MYLOGO% , simply define the variable on the web's WebPreferences page. In this case, you also have to upload logo.gif to the same directory.: |
|
-
-
Set MYLOGO = %PUBURLPATH%/%MAINWEB%/LogoTopic/logo.gif
|
|
> > | |
|
-- MikeMannix - 30 Aug 2001 |