Welcome, Registration, and other StartingPoints; TWiki history & Wiki style; All the docs...
View   r47  >  r46  >  r45  >  r44  >  r43  >  r42  ...
TWikiVariables 47 - 06 Jan 2002 - Main.MikeMannix
Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Line: 8 to 8
 

Overview

Changed:
<
<
TWikiVariables are text strings - %VARIABLE% - that expand into content whenever a page is opened. Variables are replaced by their actual values: stored data, or system info (like the date, or the current user). There are predefined variables, and Preference variables that you set. You can also define custom variables, with new names and values.
>
>
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.
 

Predefined Variables

Changed:
<
<
Most predefined variables return values that were either defined when TWiki was installed, or taken from server info (like current username, or date and time). Many of the variables let you control how the formatted results appear.
>
>
Most predefined variables return values that were either set in the lib/twiki.cfg 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.
 
Changed:
<
<
TWiki expands the following variables (enclosed in % percent signs):
>
>
  • TIP 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 %INCLUDINGTOPIC%, %INCLUDE%, and the mighty %SEARCH%.

This version of TWiki - TWiki-4.1.2, Sat, 03 Mar 2007, build 13046 - expands the following variables (enclosed in % percent signs):

 
Line: 48 to 50
 
Returns the value of a URL parameter. Ex: %URLPARAM{"skin"}% returns print for a .../view/TWiki/TWikiVariables?skin=print URL. Is
%WIKITOOLNAME%
Changed:
<
<
Name of wiki tool, is TWiki
>
>
The name of your TWiki site - TWiki
 
%WIKIVERSION%
Changed:
<
<
Wiki tool version is TWiki-4.1.2, Sat, 03 Mar 2007, build 13046
>
>
Your current TWiki version - TWiki-4.1.2, Sat, 03 Mar 2007, build 13046
 
%USERNAME%
Changed:
<
<
Your login username is guest
>
>
Your login username - guest
 
%WIKINAME% Your Wiki username. Same as %USERNAME% if not defined in the TWikiUsers topic. Is TWikiGuest
%WIKIUSERNAME%
Changed:
<
<
Your %WIKINAME% including the Main web name. Usefull for signatures. Is Main.TWikiGuest
>
>
Your %WIKINAME% including the Main web name - always use full signatures - Main.TWikiGuest
 
%MAINWEB%
Changed:
<
<
The Main web containing TWikiUsers, OfficeLocations? and TWikiGroups. Is Main
>
>
The web containing TWikiUsers, OfficeLocations? and TWikiGroups is Main
 
%TWIKIWEB%
Changed:
<
<
The web containing all documentation and configuration of TWiki is TWiki
>
>
The web containing all documentation and site-wide preference settings for TWiki - TWiki
 
%WEB% The current web is TWiki
Line: 75 to 77
 
The web name where the includes started, e.g. the web of the first topic of nested includes. Same as %WEB% in case there is no include.
%INCLUDINGWEB%
Changed:
<
<
The web name of the topic that includes the current topic. Same as %WEB% in case there is no include.
>
>
The web name of the topic that includes the current topic - same as %WEB% if there is no INCLUDE.
 
%HOMETOPIC%
Changed:
<
<
The home topic in each web. Is WebHome
>
>
The home topic in each web - WebHome
 
%NOTIFYTOPIC%
Changed:
<
<
The notify topic in each web. Is WebNotify
>
>
The notify topic in each web - WebNotify
 
%WIKIUSERSTOPIC%
Changed:
<
<
The index topic of all registered users. Is TWikiUsers
>
>
The index topic of all registered users - TWikiUsers
 
%WIKIPREFSTOPIC%
Changed:
<
<
The web preferences topic. Is TWikiPreferences
>
>
The site-wide preferences topic - TWikiPreferences
 
%WEBPREFSTOPIC%
Changed:
<
<
The web preferences topic. Is WebPreferences
>
>
The local web preferences topic in each web - WebPreferences
 
%STATISTICSTOPIC%
Changed:
<
<
The web statistics topic. Is WebStatistics
>
>
The web statistics topic WebStatistics
 
%TOPIC%
Changed:
<
<
The current topic name, is TWikiVariables
>
>
The current topic name - TWikiVariables
 
%BASETOPIC%
Changed:
<
<
The name of the topic where the includes started, e.g. the first topic of nested includes. Same as %TOPIC% in case there is no include.
>
>
The name of the topic where a single or nested INCLUDE started - same as %TOPIC% if there is no INCLUDE.
 
%INCLUDINGTOPIC% The name of the topic that includes the current topic. Same as %TOPIC% in case there is no include.
Line: 121 to 123
 
%TOPICLIST{" <option>$name</option>"}% creates an option list (for drop down menus).
%WEBLIST{"format"}%
Changed:
<
<
Web index, e.g. list of all webs. Hidden webs are excluded, e.g. webs with a NOSEARCHALL=on preference variable. The "format" defines the format of one web item. The $name variable gets expanded to the name of the web, $qname gets expanded to double quoted name, $marker to marker where web matches selection.
>
>
Web index, ex: list of all webs. Hidden webs are excluded, e.g. webs with a NOSEARCHALL=on preference variable. The "format" defines the format of one web item. The $name variable gets expanded to the name of the web, $qname gets expanded to double quoted name, $marker to marker where web matches selection.
  Parameters are format, separator and web:
Parameter: Description: Default:
"format" Format of one line, may include $name variable "$name"
Line: 234 to 236
 
[1] Note: The search form uses identical names for input fields.
Changed:
<
<
[2] Note: A web can be excluded from a web="all" search if you define a NOSEARCHALL=on variable in its WebPreferences.
>
>
[2] Note: A web can be excluded from a web="all" search if you define a NOSEARCHALL=on variable in its WebPreferences.
 

Preferences Variables

Line: 349 to 351
 

Setting Preferences

Changed:
<
<
  • 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:
    • Set VARIABLENAME = value
>
>
  • The syntax for Preferences variables is the same anywhere in TWiki (on its own TWiki bullet line, including nested bullets):
    [3 spaces] * [space] Set [space] VARIABLENAME [space] = [value]
    Examples:
  • Set VARIABLENAME = =value=
    • Set VARIABLENAME = =value=
 

Creating Custom Variables

Line: 363 to 366
 

-- PeterThoeny - 13 Sep 2001

Changed:
<
<
-- MikeMannix? - 30 Nov 2001
>
>
-- MikeMannix? - 05 Jan 2002

TWikiVariables 46 - 02 Dec 2001 - Main.MikeMannix
Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Line: 16 to 16
 TWiki expands the following variables (enclosed in % percent signs):
Changed:
<
<
>
>
 
Variable: Expanded to:
Line: 210 to 210
 
nosearch="on" Suppress search string Show search string
noheader="on" Suppress search header
Topics: Changed: By:
Show search header
nototal="on" Do not show number of topics found Show number
Added:
>
>
format="..." Flexible custom result formatting: see FormattedSearch for usage Results in table
 Example: %SEARCH{"wiki" web="Main" scope="topic"}%
Deleted:
<
<
%SEARCH{... format="..."}% Control the formatting of an embedded search. By default, the search result display format is fixed: a table with rows of topic name and topic summary. Use the format="..." parameter to specify a custom format, typically, a bullet list or table row containing variables
Ex: %SEARCH{ "food" format="| $topic | $summary |" }%)
Two paramters can be used to specify a customized search result:
1. header="..." parameter
Use the header paramter to specify the header of a search result. It should correspond to the format of the format parameter. This parameter is optional. Ex: header="| *Topic:* | *Summary:* |"
2. format="..." parameter
Use the format paramter to specify the format of one search hit.
Ex: format="| $topic | $summary |"
Variables that can be used in the format string:
Name: Expands To:
$web Name of the web
$topic Topic name
$locked LOCKED flag (if any)
$date Time stamp of last topic update
$rev Number of last topic revision, i.e. 1.4
$wikiusername Wiki user name of last topic update, i.e. Main.JohnSmith
$summary Topic summary
$formfield(name) The field value of a form field, i.e. $formfield(TopicClassification? ) would get expanded to PublicFAQ. This applies only to topics that have a TWikiForm
$pattern(reg-exp) A regular expression pattern to extract some text from a topic, i.e. $pattern(.*?\*.*?Email\:\s*([^\n\r]+).*) extracts the email address from a bullet of format * Email: ....
Note: For $pattern(reg-exp), specify a RegularExpression that scans from start to end and contains the text you want to keep in parenthesis, ex: $pattern(.*?(from here.*?to here).*). You need to make sure that the integrity of a web page is not compromised, i.e. if you include a table make sure to include everything including the table end tag.
NOTE: Sorting is nicely covered by the TablePlugin.
For how-to tips and tricks, see: TWikiVariablesExamples?
  %METASEARCH{...}% Special search of meta data
Parameter: Description: Default:
Line: 266 to 241
 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):
Changed:
<
<
>
>
 
Variable: Level: What:
Line: 377 to 352
 
  • 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:
    • Set VARIABLENAME = value
Changed:
<
<

Customizing Variables

>
>

Creating Custom Variables

 
Changed:
<
<
See: TWikiVariables Examples?
>
>
  • 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: 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. You also have to upload logo.gif - this can be done by attaching a file to LogoTopic (any topic name you choose):
    • Set MYLOGO = %PUBURL%/%MAINWEB%/LogoTopic/logo.gif
 -- PeterThoeny - 13 Sep 2001
-- MikeMannix? - 30 Nov 2001

TWikiVariables 45 - 30 Nov 2001 - Main.MikeMannix
Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Line: 12 to 12
 

Predefined Variables

Changed:
<
<
With a couple of notable exceptions, predefined variables return set values that are defined 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.
>
>
Most predefined variables return values that were either defined when TWiki was installed, or taken from server info (like current username, or date and time). Many of the variables let you control how the formatted results appear.
 TWiki expands the following variables (enclosed in % percent signs):
Line: 205 to 205
 
regex="on" RegularExpression search Literal search
reverse="on" Reverse the direction of the search Ascending search
casesensitive="on" Case sensitive search Ignore case
Changed:
<
<
nosummary="on" Show topic title only. [3] Show topic summary
bookview="on" BookView search, e.g. show complete topic text. [3] Show topic summary.
format="..." Define a FormattedSearch, i.e.
"   * [[$topic]]: $summary". [3]
Show regular search result with topic summary
header="..." Specify header of FormattedSearch, i.e.
"   * *Topic: Summary:*".
Show regular header
>
>
nosummary="on" Show topic title only Show topic summary
bookview="on" BookView search, e.g. show complete topic text Show topic summary
 
nosearch="on" Suppress search string Show search string
noheader="on" Suppress search header
Topics: Changed: By:
Show search header
nototal="on" Do not show number of topics found Show number
Example: %SEARCH{"wiki" web="Main" scope="topic"}%
Changed:
<
<
>
>
%SEARCH{... format="..."}% Control the formatting of an embedded search. By default, the search result display format is fixed: a table with rows of topic name and topic summary. Use the format="..." parameter to specify a custom format, typically, a bullet list or table row containing variables
Ex: %SEARCH{ "food" format="| $topic | $summary |" }%)
Two paramters can be used to specify a customized search result:
1. header="..." parameter
Use the header paramter to specify the header of a search result. It should correspond to the format of the format parameter. This parameter is optional. Ex: header="| *Topic:* | *Summary:* |"
2. format="..." parameter
Use the format paramter to specify the format of one search hit.
Ex: format="| $topic | $summary |"
Variables that can be used in the format string:
Name: Expands To:
$web Name of the web
$topic Topic name
$locked LOCKED flag (if any)
$date Time stamp of last topic update
$rev Number of last topic revision, i.e. 1.4
$wikiusername Wiki user name of last topic update, i.e. Main.JohnSmith
$summary Topic summary
$formfield(name) The field value of a form field, i.e. $formfield(TopicClassification? ) would get expanded to PublicFAQ. This applies only to topics that have a TWikiForm
$pattern(reg-exp) A regular expression pattern to extract some text from a topic, i.e. $pattern(.*?\*.*?Email\:\s*([^\n\r]+).*) extracts the email address from a bullet of format * Email: ....
Note: For $pattern(reg-exp), specify a RegularExpression that scans from start to end and contains the text you want to keep in parenthesis, ex: $pattern(.*?(from here.*?to here).*). You need to make sure that the integrity of a web page is not compromised, i.e. if you include a table make sure to include everything including the table end tag.
NOTE: Sorting is nicely covered by the TablePlugin.
For how-to tips and tricks, see: TWikiVariablesExamples?
  %METASEARCH{...}% Special search of meta data
Parameter: Description: Default:
Line: 235 to 260
 [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.

Deleted:
<
<
[3] Note: Regular search, no summary, BookView and FormattedSearch are exclusive.
 

Preferences Variables

Line: 354 to 377
 
  • 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:
    • Set VARIABLENAME = value
Changed:
<
<

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.
>
>

Customizing Variables

 
Changed:
<
<
Example: 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. You also have to upload logo.gif - this can be done by attaching a file to LogoTopic (any topic name you choose):
    • Set MYLOGO = %PUBURL%/%MAINWEB%/LogoTopic/logo.gif
>
>
See: TWikiVariables Examples?
 
Deleted:
<
<
-- MikeMannix? - 30 Aug 2001
 -- PeterThoeny - 13 Sep 2001
Added:
>
>
-- MikeMannix? - 30 Nov 2001

TWikiVariables 44 - 25 Oct 2001 - Main.PeterThoeny
Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Line: 205 to 205
 
regex="on" RegularExpression search Literal search
reverse="on" Reverse the direction of the search Ascending search
casesensitive="on" Case sensitive search Ignore case
Changed:
<
<
nosummary="on" Show topic title only Show topic summary
bookview="on" BookView search, e.g. show complete topic text Show topic summary
>
>
nosummary="on" Show topic title only. [3] Show topic summary
bookview="on" BookView search, e.g. show complete topic text. [3] Show topic summary.
format="..." Define a FormattedSearch, i.e.
"   * [[$topic]]: $summary". [3]
Show regular search result with topic summary
header="..." Specify header of FormattedSearch, i.e.
"   * *Topic: Summary:*".
Show regular header
 
nosearch="on" Suppress search string Show search string
noheader="on" Suppress search header
Topics: Changed: By:
Show search header
nototal="on" Do not show number of topics found Show number
Line: 233 to 235
 [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.

Added:
>
>
[3] Note: Regular search, no summary, BookView and FormattedSearch are exclusive.
 

Preferences Variables


TWikiVariables 43 - 15 Sep 2001 - Main.MikeMannix
Line: 1 to 1
 
META TOPICPARENT name="WebHome"
Deleted:
<
<

<-- template: messages.nat.tmpl -->
Warning: Can't find topic TWiki.UtilTempDocNote
 

TWiki Variables

Changed:
<
<
Text strings expanded on the fly include predefined, preference-driven and custom-defined data
>
>
Text strings expanded on the fly to display data or system info
 

Overview

Changed:
<
<
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!
>
>
TWikiVariables are text strings - %VARIABLE% - that expand into content whenever a page is opened. Variables are replaced by their actual values: stored data, or system info (like the date, or the current user). There are predefined variables, and Preference variables that you set. You can also define custom variables, with new names and values.
 

Predefined Variables

Changed:
<
<
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.
>
>
With a couple of notable exceptions, predefined variables return set values that are defined 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.
 
Changed:
<
<
TWiki expands the following variables enclosed in % percent signs:
>
>
TWiki expands the following variables (enclosed in % percent signs):
 
Changed:
<
<
>
>
 
Variable: Expanded to:
Line: 88 to 86
 
%WIKIUSERSTOPIC% The index topic of all registered users. Is TWikiUsers
Added:
>
>
%WIKIPREFSTOPIC% The web preferences topic. Is TWikiPreferences
 
%WEBPREFSTOPIC% The web preferences topic. Is WebPreferences
Line: 238 to 239
 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):
Changed:
<
<
>
>
 
Variable: Level: What:
Line: 353 to 354
 
  • 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.
Changed:
<
<
>
>
 Example: 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. You also have to upload logo.gif - this can be done by attaching a file to LogoTopic (any topic name you choose):
    • Set MYLOGO = %PUBURL%/%MAINWEB%/LogoTopic/logo.gif

Revision 47r47 - 06 Jan 2002 - 03:45:00 - MikeMannix?
Revision 46r46 - 02 Dec 2001 - 11:58:00 - MikeMannix?
Revision 45r45 - 30 Nov 2001 - 10:14:00 - MikeMannix?
Revision 44r44 - 25 Oct 2001 - 02:10:24 - PeterThoeny?
Revision 43r43 - 15 Sep 2001 - 10:01:19 - MikeMannix?
Revision 42r42 - 14 Sep 2001 - 06:07:40 - PeterThoeny?
This site is powered by the TWiki collaboration platform.
All material on this collaboration platform is the property of the contributing authors.
All material marked as authored by Eben Moglen is available under the license terms CC-BY-SA version 4.
Syndicate this site RSSATOM