TWikiVariables 47 - 06 Jan 2002 - Main.MikeMannix
|
|
META TOPICPARENT | name="WebHome" |
| | Overview | |
< < | 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 | |
< < | 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. | | | |
< < | TWiki expands the following variables (enclosed in % percent signs): | > > |
-
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): | | | | Returns the value of a URL parameter. Ex: %URLPARAM{"skin"}% returns print for a .../view/TWiki/TWikiVariables?skin=print URL. Is |
%WIKITOOLNAME% | | |
< < | Name of wiki tool, is TWiki | | > > | The name of your TWiki site - TWiki | | | | |
< < | 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 | | | | |
< < | 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% |
| |
< < | 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 | | | | |
< < | | > > | | | | |
< < | 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 |
| | 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% | | |
< < | 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. | | | | |
< < | The home topic in each web. Is WebHome | | > > | The home topic in each web - WebHome | | | | |
< < | | > > | | | | |
< < | The index topic of all registered users. Is TWikiUsers | | > > | The index topic of all registered users - TWikiUsers | | | | |
< < | The web preferences topic. Is TWikiPreferences | | > > | The site-wide preferences topic - TWikiPreferences | | | | |
< < | The web preferences topic. Is WebPreferences | | > > | The local web preferences topic in each web - WebPreferences | | | | |
< < | The web statistics topic. Is WebStatistics | | > > | The web statistics topic WebStatistics | | | | |
< < | The current topic name, is TWikiVariables | | > > | The current topic name - TWikiVariables | | | | |
< < | 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. |
| | %TOPICLIST{" <option>$name</option>"}% creates an option list (for drop down menus).
%WEBLIST{"format"}% | | |
< < | 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:
| |
[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. | > > | [2] Note: A web can be excluded from a web="all" search if you define a NOSEARCHALL=on variable in its WebPreferences. | |
Preferences Variables | | 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:
| > > |
- 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 | |
-- PeterThoeny - 13 Sep 2001
| |
< < | -- MikeMannix? - 30 Nov 2001 | > > | -- MikeMannix? - 05 Jan 2002 |
|
TWikiVariables 46 - 02 Dec 2001 - Main.MikeMannix
|
|
META TOPICPARENT | name="WebHome" |
| | TWiki expands the following variables (enclosed in % percent signs): | |
< < | | > > | | | | |
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 |
| |
> > |
format="..." | Flexible custom result formatting: see FormattedSearch for usage | Results in table |
| | Example: %SEARCH{"wiki" web="Main" scope="topic"}%
|
| |
< < | | %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
| | 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): | |
< < | | > > | | | | |
- 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:
| |
< < | Customizing Variables | > > | Creating Custom Variables | | | |
< < | 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
|
|
META TOPICPARENT | name="WebHome" |
| | Predefined Variables | |
< < | 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): | |
regex="on" | RegularExpression search | Literal search |
reverse="on" | Reverse the direction of the search | Ascending search |
casesensitive="on" | Case sensitive search | Ignore case |
| |
< < |
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"}% | |
< < | | |
> > | |
%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
| | [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. | |
< < | [3] Note: Regular search, no summary, BookView and FormattedSearch are exclusive. | |
Preferences Variables | |
- 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.
| > > | Customizing Variables | | | |
< < |
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? | | | |
< < | -- MikeMannix? - 30 Aug 2001 | | -- PeterThoeny - 13 Sep 2001
| |
> > | -- MikeMannix? - 30 Nov 2001 |
|
TWikiVariables 44 - 25 Oct 2001 - Main.PeterThoeny
|
|
META TOPICPARENT | name="WebHome" |
| |
regex="on" | RegularExpression search | Literal search |
reverse="on" | Reverse the direction of the search | Ascending search |
casesensitive="on" | Case sensitive search | Ignore case |
| |
< < |
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 |
| | [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. | |
> > | [3] Note: Regular search, no summary, BookView and FormattedSearch are exclusive. | |
Preferences Variables |
|
TWikiVariables 43 - 15 Sep 2001 - Main.MikeMannix
|
|
META TOPICPARENT | name="WebHome" |
| |
< < |
<-- template: messages.nat.tmpl -->
Warning: Can't find topic TWiki.UtilTempDocNote
| |
TWiki Variables | |
< < | 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 | |
< < | 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 | |
< < | 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. | | | |
< < | TWiki expands the following variables enclosed in % percent signs: | > > | TWiki expands the following variables (enclosed in % percent signs): | | | |
< < | | > > | | | | | %WIKIUSERSTOPIC% |
The index topic of all registered users. Is TWikiUsers |
|
| |
> > | %WIKIPREFSTOPIC% |
The web preferences topic. Is TWikiPreferences |
|
| | %WEBPREFSTOPIC% |
The web preferences topic. Is WebPreferences |
|
| | 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): | |
< < | | > > | | | | |
- 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
|
|
Revision 47 | r47 - 06 Jan 2002 - 03:45:00 - MikeMannix? |
Revision 46 | r46 - 02 Dec 2001 - 11:58:00 - MikeMannix? |
Revision 45 | r45 - 30 Nov 2001 - 10:14:00 - MikeMannix? |
Revision 44 | r44 - 25 Oct 2001 - 02:10:24 - PeterThoeny? |
Revision 43 | r43 - 15 Sep 2001 - 10:01:19 - MikeMannix? |
Revision 42 | r42 - 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.
|
|