summaryrefslogtreecommitdiff
path: root/TWiki
diff options
context:
space:
mode:
authorMikeMannix <MikeMannix>2001-11-30 10:14:00 +0000
committerMikeMannix <MikeMannix>2001-11-30 10:14:00 +0000
commit83bd4a599e788ecfeb634efc6fc8e14380bf9b45 (patch)
treef9ca3b56b5575ed35dcc6338765c45f03b1aa39f /TWiki
parent03392dd0c705989aa894b8ff2c83e9bf4c2392ca (diff)
none
Diffstat (limited to 'TWiki')
-rw-r--r--TWiki/TWikiVariables.mdwn78
1 files changed, 52 insertions, 26 deletions
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 - <code>%VARIABLE%</code> - that expand into con
## <a name="Predefined_Variables"> Predefined Variables </a>
-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 <code>**%**</code> percent signs):
@@ -392,23 +392,13 @@ With a couple of notable exceptions, predefined variables return set values that
</tr>
<tr>
<td><code>nosummary="on"</code></td>
- <td> Show topic title only. [3] </td>
+ <td> Show topic title only </td>
<td> Show topic summary </td>
</tr>
<tr>
<td><code>bookview="on"</code></td>
- <td><span style="background:"><font color="">Book View</font></span><a href="http://LOCATION/BookView">?</a> search, e.g. show complete topic text. [3] </td>
- <td> Show topic summary. </td>
- </tr>
- <tr>
- <td><code>format="..."</code></td>
- <td> Define a <span style="background:"><font color="">Formatted Search</font></span><a href="http://LOCATION/FormattedSearch">?</a>, i.e. <br /><code>"   * [<nop>[$topic]]: $summary"</nop></code>. [3] </td>
- <td> Show regular search result with topic summary </td>
- </tr>
- <tr>
- <td><code>header="..."</code></td>
- <td> Specify header of <span style="background:"><font color="">Formatted Search</font></span><a href="http://LOCATION/FormattedSearch">?</a>, i.e. <br /><code>"   * <nop>*Topic: Summary:*"</nop></code>. </td>
- <td> Show regular header </td>
+ <td><span style="background:"><font color="">Book View</font></span><a href="http://LOCATION/BookView">?</a> search, e.g. show complete topic text </td>
+ <td> Show topic summary </td>
</tr>
<tr>
<td><code>nosearch="on"</code></td>
@@ -428,6 +418,51 @@ With a couple of notable exceptions, predefined variables return set values that
</table> Example: <code><b>%<nop>SEARCH{"wiki" web="%MAINWEB%" scope="topic"}%</nop></b></code></td>
</tr>
<tr>
+ <td><code>%<nop>SEARCH{... format="..."}%</nop></code></td>
+ <td><strong>Control the formatting of an embedded search.</strong> By default, the search result display format is fixed: a table with rows of topic name and topic summary. Use the <code>format="..."</code> parameter to specify a custom format, typically, a bullet list or table row containing variables <br /> Ex: <code>%<nop>SEARCH{ "food" format="| $topic | $summary |" }%</nop></code>) <br /><strong>Two paramters can be used to specify a customized search result:</strong><br /><strong>1.</strong> <code>header="..."</code> parameter <br /> 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: <code>header="| <nop>*Topic:*<nop> | <nop>*Summary:*<nop> |"</nop></nop></nop></nop></code><br /><strong>2.</strong> <code>format="..."</code> parameter <br /><strong>Use the format paramter to specify the format of one search hit.</strong><br /> Ex: <code>format="| $topic | $summary |"</code><br /><strong>Variables that can be used in the format string:</strong><table border="1" cellpadding="1" cellspacing="0">
+ <tr>
+ <th bgcolor="#99CCCC"><strong>Name:</strong></th>
+ <th bgcolor="#99CCCC"><strong>Expands To:</strong></th>
+ </tr>
+ <tr>
+ <td><code>$web</code></td>
+ <td> Name of the web </td>
+ </tr>
+ <tr>
+ <td><code>$topic</code></td>
+ <td> Topic name </td>
+ </tr>
+ <tr>
+ <td><code>$locked</code></td>
+ <td> LOCKED flag (if any) </td>
+ </tr>
+ <tr>
+ <td><code>$date</code></td>
+ <td> Time stamp of last topic update </td>
+ </tr>
+ <tr>
+ <td><code>$rev</code></td>
+ <td> Number of last topic revision, i.e. <code>1.4</code></td>
+ </tr>
+ <tr>
+ <td><code>$wikiusername</code></td>
+ <td> Wiki user name of last topic update, i.e. <code>%MAINWEB%.<nop>JohnSmith</nop></code></td>
+ </tr>
+ <tr>
+ <td><code>$summary</code></td>
+ <td> Topic summary </td>
+ </tr>
+ <tr>
+ <td><code>$formfield(name)</code></td>
+ <td> The field value of a form field, i.e. <code>$formfield(<span style="background:"><font color="">Topic Classification</font></span><a href="http://LOCATION/TopicClassification">?</a>)</code> would get expanded to <code>PublicFAQ</code>. This applies only to topics that have a <span style="background:"><font color="">TWiki Form</font></span><a href="http://LOCATIONTWiki/TWikiForms">?</a></td>
+ </tr>
+ <tr>
+ <td><code>$pattern(reg-exp)</code></td>
+ <td> A regular expression pattern to extract some text from a topic, i.e. <code>$pattern(.*?\*.*?Email\:\s*([^\n\r]+).*)</code> extracts the email address from a bullet of format <code>* Email: ...</code>. </td>
+ </tr>
+ </table><strong><em>Note:</em></strong> For <code>$pattern(reg-exp)</code>, specify a <span style="background:"><font color="">Regular Expression</font></span><a href="http://LOCATIONTWiki/RegularExpression">?</a> that scans from start to end and contains the text you want to keep in parenthesis, ex: <code>$pattern(.*?(from here.*?to here).*)</code>. 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. <br /><strong>NOTE:</strong> Sorting is nicely covered by the <span style="background:"><font color="">Table Plugin</font></span><a href="http://LOCATIONTWiki/TablePlugin">?</a>. <br /><strong><em>For how-to tips and tricks, see: <span style="background:"><font color="">TWiki Variables Examples</font></span><a href="http://LOCATION/TWikiVariablesExamples">?</a></em></strong></td>
+ </tr>
+ <tr>
<td><code>%<nop>METASEARCH{...}%</nop></code></td>
<td> Special search of meta data <table border="1" cellpadding="1" cellspacing="0">
<tr>
@@ -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.
## <a name="Preferences_Variables"> Preferences Variables </a>
@@ -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: <br />[6 spaces] \* [space] Set [space] VARIABLENAME [space] = [value] <br />**_Example:_**
* <code>**Set VARIABLENAME = value**</code>
-## <a name="Creating_Custom_Variables"> Creating Custom Variables </a>
+## <a name="Customizing_Variables"> Customizing Variables </a>
-* 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**
->
-> <br />
->
-> * To place a logo anywhere in a web by typing <code>**%MYLOGO%**</code>, 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):
-> * <code>**Set MYLOGO = %PUBURL%/%MAINWEB%/LogoTopic/logo.gif**</code>
+**_See:_** [[TWikiVariablesExamples]]
--- [[MikeMannix]] - 30 Aug 2001 <br /> -- [[PeterThoeny]] - 13 Sep 2001 <br />
+-- [[PeterThoeny]] - 13 Sep 2001 <br /> -- [[MikeMannix]] - 30 Nov 2001