data/TWiki/TWikiVariables.txt
changeset 0 414e01d06fd5
child 1 e2915a7cbdfa
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/data/TWiki/TWikiVariables.txt	Sat Jan 26 15:50:53 2008 +0100
     1.3 @@ -0,0 +1,136 @@
     1.4 +%META:TOPICINFO{author="TWikiContributor" date="1173217738" format="1.0" version="83"}%
     1.5 +%META:TOPICPARENT{name="WebHome"}%
     1.6 +%STARTSECTION{type="include"}%
     1.7 +---+ TWiki Variables
     1.8 +
     1.9 +_Special text strings expand on the fly to display user data or system info_
    1.10 +
    1.11 +<nop>TWikiVariables are text strings - =%<nop>VARIABLE%= or =%<nop>VARIABLE{ parameter="value" }%= - that expand into content whenever a topic is rendered for viewing. There are two types of variables:
    1.12 +   1 Preferences variables: Can be defined and changed by the user
    1.13 +   1 Predefined variables: Defined by the TWiki system or by Plugins (for example, the SpreadSheetPlugin introduces a =%<nop>CALC{}%= variable)
    1.14 +
    1.15 +%TOC%
    1.16 +
    1.17 +---++ Using Variables
    1.18 +
    1.19 +To use a variable type its name. For example,
    1.20 +   * type =%<nop>T%= to get %T% (a preferences variable)
    1.21 +   * type =%<nop>TOPIC%= to get =%TOPIC%= (a predefined variable)
    1.22 +   * type =%<nop>CALC{ "$UPPER(Text)" }%= to get =TEXT= (a variable defined by Plugin)
    1.23 +
    1.24 +__Note:__
    1.25 +   * To leave a variable unexpanded, precede it with an exclamation point, e.g. type =!%<nop>TOPIC%= to get =%<nop>TOPIC%=
    1.26 +   * Variables are expanded relative to the topic they are _used_ in, not the topic they are _defined_ in
    1.27 +   * Type =%<nop>ALLVARIABLES%= to get a full listing of all variables defined for a particular topic
    1.28 +
    1.29 +---++ Variable Names
    1.30 +Variable names must start with a letter. The following characters can be letters, numbers and the underscore '_'. You can use both upper-case and lower-case letters and you can mix the characteres. E.g. =%<nop>MYVAR%=, =%<nop>MyVar%=, =%<nop>My2ndVar%=, and =%<nop>My_Var%= are all valid variable names. Variables are case sensitive. =%<nop>MyVAR%= and =%<nop>MYVAR%= are not the same variable.
    1.31 +
    1.32 +By convention all settings, predefined variables and variables used by plugins are always UPPER-CASE.
    1.33 +
    1.34 +#SettingPrefs
    1.35 +#PreferencesVariables
    1.36 +---++ Preferences Variables
    1.37 +
    1.38 +Unlike predefined variables, preferences variables can be defined by the user in various places.
    1.39 +
    1.40 +---+++ Setting Preferences Variables
    1.41 +You can set variables in all the following places:
    1.42 +   1 local site level in [[%SYSTEMWEB%.TWikiPreferences][%SYSTEMWEB%.TWikiPreferences]]
    1.43 +   1 plugin topics (see TWikiPlugins)
    1.44 +   1 local site level in [[%LOCALSITEPREFS%][%LOCALSITEPREFS%]]
    1.45 +   1 user level in individual user topics in %USERSWEB% web
    1.46 +   1 web level in %WEBPREFSTOPIC% of each web
    1.47 +   1 topic level in topics in webs
    1.48 +   1 session variables (if sessions are enabled)
    1.49 +
    1.50 +Settings at higher-numbered levels override settings of the same variable at lower numbered levels, unless the variable was included in the setting of FINALPREFERENCES at a lower-numbered level, in which case it is locked at the value it has at that level.
    1.51 +
    1.52 +If you are setting a variable and using it in the same topic, note that TWiki reads all the variable settings from the saved version of the topic before it displays anything.  This means you can use a variable anywhere in the topic, even if you set it somewhere inconspicuous near the end. *But beware:*  it also means that if you change the setting of a variable you are using in the same topic, ==Preview== will show the wrong thing, and you must ==Save== the topic to see it correctly.
    1.53 +
    1.54 +The syntax for setting Variables is the same anywhere in TWiki (on its own TWiki bullet line, including nested bullets): <br /> =[multiple of 3 spaces] * [space] Set [space] VARIABLENAME [space] = [space] value=
    1.55 +<blockquote>
    1.56 +*Examples:*
    1.57 +   * ==<nop>Set VARIABLENAME = value==
    1.58 +      * ==<nop>Set VARIABLENAME = value==
    1.59 +</blockquote>
    1.60 +Spaces between the = sign and the value will be ignored. You can split a value over several lines by indenting following lines with spaces - as long as you don't try to use * as the first character on the following line.
    1.61 +<blockquote>
    1.62 +*Example:*
    1.63 +<pre>
    1.64 +   * <nop>Set VARIABLENAME = value starts here
    1.65 +     and continues here
    1.66 +</pre>
    1.67 +</blockquote>
    1.68 +
    1.69 +Whatever you include in your Variable will be expanded on display, exactly as if it had been entered directly.
    1.70 +
    1.71 +<blockquote>
    1.72 +*Example: Create a custom logo variable* <br />
    1.73 +   * To place a logo anywhere in a web by typing ==%<nop>MYLOGO%==, define the Variable on the web's WebPreferences topic, and upload a logo file, ex: =mylogo.gif=. You can upload by [[FileAttachment][attaching the file]] to WebPreferences, or, to avoid clutter, to any other topic in the same web, e.g. =LogoTopic=. Sample variable setting in WebPreferences:
    1.74 +      * ==<nop>Set MYLOGO = %<nop>PUBURL%/%<nop>WEB%/LogoTopic/mylogo.gif==
    1.75 +</blockquote>
    1.76 +
    1.77 +You can also set preferences variables on a topic by clicking the link =Edit topic preference settings= under =More topic actions=. Preferences set in this manner are not visible in the topic text, but take effect nevertheless.
    1.78 +
    1.79 +---+++ Access Control Variables
    1.80 +
    1.81 +These are special types of preferences variables to control access to content. TWikiAccessControl explains these security settings in detail.
    1.82 +
    1.83 +---+++ Local values for variables
    1.84 +Certain topics (a users home topic, web site and default preferences topics) have a problem; variables defined in those topics can have two meanings. For example, consider a user topic. A user may want to use a double-height edit box when they are editing their home topic - but *only* when editing their home topic. The rest of the time, they want to have a normal edit box. This separation is achieved using =Local= in place of =Set= in the variable definition. For example, if the user sets the following in their home topic:
    1.85 +<verbatim>
    1.86 +   * Set EDITBOXHEIGHT = 10
    1.87 +   * Local EDITBOXHEIGHT = 20
    1.88 +</verbatim>
    1.89 +Then when they are editing any other topic, they will get a 10 high edit box. However when they are editing their home topic, they will get a 20 high edit box.
    1.90 +=Local= can be used wherever a preference needs to take a different value depending on where the current operation is being performed.
    1.91 +
    1.92 +Use this powerful feature with great care! =%<nop>ALLVARIABLES%= can be used to get a listing of the values of all variables in their evaluation order, so you can see variable scope if you get confused.
    1.93 +
    1.94 +---+++ Frequently Used Preferences Variables
    1.95 +
    1.96 +The following preferences variables are frequently used. They are defined in TWikiPreferences#Miscellaneous_Settings:
    1.97 +   * =%<nop>BR%= - line break
    1.98 +   * =%<nop>BULLET%= - bullet sign
    1.99 +   * =%<nop>BB%= - line break and bullet combined
   1.100 +   * =%<nop>BB2%= - indented line break and bullet
   1.101 +   * =%<nop>RED% text %<nop>ENDCOLOR%= - colored text (also =%<nop>YELLOW%=, =%<nop>ORANGE%=, =%<nop>PINK%=, =%<nop>PURPLE%=, =%<nop>TEAL%=, =%<nop>NAVY%=, =%<nop>BLUE%=, =%<nop>AQUA%=, =%<nop>LIME%=, =%<nop>GREEN%=, =%<nop>OLIVE%=, =%<nop>MAROON%=, =%<nop>BROWN%=, =%<nop>BLACK%=, =%<nop>GRAY%=, =%<nop>SILVER%=, =%<nop>WHITE%=)
   1.102 +   * =%<nop>H%= - %H% Help icon
   1.103 +   * =%<nop>I%= - %I% Idea icon
   1.104 +   * =%<nop>M%= - %M% Moved to icon
   1.105 +   * =%<nop>N%= - %N% New icon
   1.106 +   * =%<nop>P%= - %P% Refactor icon
   1.107 +   * =%<nop>Q%= - %Q% Question icon
   1.108 +   * =%<nop>S%= - %S% Pick icon
   1.109 +   * =%<nop>T%= - %T% Tip icon
   1.110 +   * =%<nop>U%= - %U% Updated icon
   1.111 +   * =%<nop>X%= - %X% Alert icon
   1.112 +   * =%<nop>Y%= - %Y% Done icon
   1.113 +
   1.114 +There are additional useful preferences variables defined in TWikiPreferences, in [[%LOCALSITEPREFS%]], and in WebPreferences of every web.
   1.115 +
   1.116 +#PreDef
   1.117 +---++ Predefined Variables
   1.118 +
   1.119 +Most predefined variables return values that were either set in the configuration when TWiki was installed, or taken from server info (such as current username, or date and time). Some, like =%<nop>SEARCH%=, are powerful and general tools.
   1.120 +
   1.121 +   * %X% Predefined variables can be overridden by [[#PreferencesVariables][preferences variables]]
   1.122 +   * %X% Plugins may extend the set of predefined variables (see individual Plugins topics for details)
   1.123 +   * %T% *Take the time to thoroughly read through ALL preference variables.* If you actively configure your site, review variables periodically. They cover a wide range of functions, and it can be easy to miss the one perfect variable for something you have in mind. For example, see =%<nop>INCLUDINGTOPIC%=, =%<nop>INCLUDE%=, and the mighty =%<nop>SEARCH%=.
   1.124 +
   1.125 +This version of TWiki - %WIKIVERSION% - predefines the following variables:
   1.126 +
   1.127 +%SEARCH{
   1.128 +    "^Var[A-Z_0-9]+$"
   1.129 +    casesensitive="on"
   1.130 +    type="regex"
   1.131 +    scope="topic"
   1.132 +    format="$percntINCLUDE{$web.$topic}$percnt"
   1.133 +    nonoise="on"
   1.134 +}%
   1.135 +
   1.136 +%ENDSECTION{type="include"}%
   1.137 +
   1.138 +__Related Topics:__ UserDocumentationCategory
   1.139 +