Difference: TWikiVariables (45 vs. 46)

Revision 4602 Dec 2001 - 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:
<-- -->
Sorted ascending
$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: ....
$locked LOCKED flag (if any)
$web Name of the web
$rev Number of last topic revision, i.e. 1.4
$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
$date Time stamp of last topic update
$topic Topic name
$summary Topic summary
$wikiusername Wiki user name of last topic update, i.e. Main.JohnSmith
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
 
This site is powered by the TWiki collaboration platformCopyright � by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.TWikiVariables