From 83bd4a599e788ecfeb634efc6fc8e14380bf9b45 Mon Sep 17 00:00:00 2001 From: MikeMannix Date: Fri, 30 Nov 2001 10:14:00 +0000 Subject: none --- TWiki/TWikiVariables.mdwn | 78 +++++++++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 26 deletions(-) (limited to 'TWiki') diff --git a/TWiki/TWikiVariables.mdwn b/TWiki/TWikiVariables.mdwn index 01b1fd84..3bf52a56 100644 --- a/TWiki/TWikiVariables.mdwn +++ b/TWiki/TWikiVariables.mdwn @@ -10,7 +10,7 @@ TWikiVariables are text strings - %VARIABLE% - that expand into con ## 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. %WIKITOOLNAME% expands the following variables (enclosed in **%** percent signs): @@ -392,23 +392,13 @@ With a couple of notable exceptions, predefined variables return set values that nosummary="on" - Show topic title only. [3] + Show topic title only Show topic summary bookview="on" - Book View? search, e.g. show complete topic text. [3] - Show topic summary. - - - format="..." - Define a Formatted Search?, i.e.
"   * [[$topic]]: $summary". [3] - Show regular search result with topic summary - - - header="..." - Specify header of Formatted Search?, i.e.
"   * *Topic: Summary:*". - Show regular header + Book View? search, e.g. show complete topic text + Show topic summary nosearch="on" @@ -427,6 +417,51 @@ With a couple of notable exceptions, predefined variables return set values that Example: %SEARCH{"wiki" web="%MAINWEB%" 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. %MAINWEB%.JohnSmith
$summary Topic summary
$formfield(name) The field value of a form field, i.e. $formfield(Topic Classification?) would get expanded to PublicFAQ. This applies only to topics that have a TWiki Form?
$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 Regular Expression? 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 Table Plugin?.
For how-to tips and tricks, see: TWiki Variables Examples? + %METASEARCH{...}% Special search of meta data @@ -469,8 +504,6 @@ With a couple of notable exceptions, predefined variables return set values that > : 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 %WEBPREFSTOPIC%. -> -> [3] **_Note_**: Regular search, no summary, [[BookView]] and [[FormattedSearch]] are exclusive. ## Preferences Variables @@ -616,15 +649,8 @@ Additional variables are defined in the preferences ( site-level ( **_SL_** ) in * 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** -## Creating Custom Variables +## Customizing 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: 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 [[FileAttachment]] to `LogoTopic` (any topic name you choose): -> * **Set MYLOGO = %PUBURL%/%MAINWEB%/LogoTopic/logo.gif** +**_See:_** [[TWikiVariablesExamples]] --- [[MikeMannix]] - 30 Aug 2001
-- [[PeterThoeny]] - 13 Sep 2001
+-- [[PeterThoeny]] - 13 Sep 2001
-- [[MikeMannix]] - 30 Nov 2001 -- cgit v1.2.3