Topic name, hyphenated each 30 characters with separator "-<br />"
$topic(40, ...)
Topic name, shortened to 40 characters with "..." indication
Added:
> >
$topictitle
Topic title, in order of sequence defined by: Form field named "Title", topic preference setting named TITLE, topic name
$parent
Name of parent topic; empty if not set
$parent(20)
Name of parent topic, same hyphenation/shortening like $topic()
$text
Formatted topic text. In case of a multiple="on" search, it is the line found for each search hit.
Added:
> >
$text(encode:type)
Same as above, but encoded in the specified type. Possible types are the same as ENCODE. Though ENCODE can take the extra parameter, $text(encode:type) cannot. e.g. $text(encode:html)
$locked
LOCKED flag (if any)
$date
Time stamp of last topic update, e.g. 12 Mar 2025 - 20:03
$isodate
Time stamp of last topic update, e.g. 2025-03-12T20:03Z
Line: 59 to 61
$changes(n)
Summary of changes between latest rev and rev n
$formname
The name of the form attached to the topic; empty if none
$formfield(name)
The field value of a form field; for example, $formfield(TopicClassification) would get expanded to PublicFAQ. This applies only to topics that have a TWikiForm
Added:
> >
$formfield(name, encode:type)
Form field value, encoded in the specified type. This is in parallel to $text(encode:type) shown above. Comma followed by encode:type can be added to the $formfield(...) syntax below as well. But it needs to be the last paramer. e.g. $formfield(Description, 20, encode:html)
$formfield(name, 10)
Form field value, "- " hyphenated each 10 characters
$formfield(name, 20, -<br />)
Form field value, hyphenated each 20 characters with separator "-<br />"
$formfield(name, 30, ...)
Form field value, shortened to 30 characters with "..." indication
$query(query-syntax)
Access topic meta data using SQL-like QuerySearch syntax. Example: • $query(attachments.arraysize) returns the number of files attached to the current topic • $query(attachments[name~'*.gif'].size) returns an array with size of all .gif attachments, such as 848, 1425, 923 • $query(parent.name) is equivalent to $parent
Added:
> >
$query(query-syntax, encode:type)
QuerySearch result is encoded in the specified type. This is in parallel to $text(encode:type) mentioned above
$pattern(reg-exp)
A regular expression pattern to extract some text from a topic (does not search meta data; use $formfield instead). In case of a multiple="on" search, the pattern is applied to the line found in each search hit. • Specify a RegularExpression that covers the whole text (topic or line), which typically starts with .*, and must end in .* • Put text you want to keep in parenthesis, like $pattern(.*?(from here.*?to here).*) • Example: $pattern(.*?\*.*?Email\:\s*([^\n\r]+).*) extracts the e-mail address from a bullet of format * Email: ... • This example has non-greedy .*? patterns to scan for the first occurance of the Email bullet; use greedy .* patterns to scan for the last occurance • Limitation: Do not use .*) inside the pattern, e.g. $pattern(.*foo(.*)bar.*) does not work, but $pattern(.*foo(.*?)bar.*) does • Note: Make sure that the integrity of a web page is not compromised; for example, if you include an HTML table make sure to include everything including the table end tag
Added:
> >
$pattern(reg-exp, encode:type)
A text extracted by reg-exp is encoded in the specified type. This is in parallel to $text(encode:type) mentioned above
$count(reg-exp)
Count of number of times a regular expression pattern appears in the text of a topic (does not search meta data). Follows guidelines for use and limitations outlined above under $pattern(reg-exp). Example: $count(.*?(---[+][+][+][+]) .*) counts the number of <H4> headers in a page.
$ntopics
Number of topics found in current web. This is the current topic count, not the total number of topics
Added:
> >
$tntopics
The total number of topics matched
$nwebs
The number of webs searched
$nhits
Number of hits if multiple="on". Cumulative across all topics in current web. Identical to $ntopics unless multiple="on"
$n or $n()
New line. Use $n() if followed by alphanumeric character, e.g. write Foo$n()Bar instead of Foo$nBar
$nop or $nop()
Is a "no operation". This variable gets removed; useful for nested search
Number of hits if multiple="on". Cumulative across all topics in current web. Identical to $ntopics unless multiple="on"
$n or $n()
New line. Use $n() if followed by alphanumeric character, e.g. write Foo$n()Bar instead of Foo$nBar
$nop or $nop()
Is a "no operation". This variable gets removed; useful for nested search
$quot or \"
Double quote (")
$aquot
Apostrophe quote (')
$percnt
Percent sign (%)
$dollar
Dollar sign ($)
$lt
Less than sign (<)
$gt
Greater than sign (>)
Added:
> >
4. default="..." parameter
Use the default parameter to specify a default message if there are no hits in a web. This parameter is optional. Example: default="| *Note* | Nothing found in the [[$web.WebHome][$web]] web |"
Variables that can be used in the default string:
New line. Use $n() if followed by alphanumeric character, e.g. write Foo$n()Bar instead of Foo$nBar
$nop or $nop()
Is a "no operation". This variable gets removed; useful for nested search
$quot or \"
Double quote (")
$aquot
Apostrophe quote (')
$percnt
Percent sign (%)
$dollar
Dollar sign ($)
$lt
Less than sign (<)
$gt
Greater than sign (>)
Results pagination
When a search return many results, you may want to paginate them having the following line below the results.
«Prev12345Next»SearchResultsPagination describes how to do it.
TWikiFAQ: Frequently Asked Questions About TWiki This is a real FAQ, and also a demo of an easily implemented knowledge base solution. To see how it`s done, view the source...
TextFormattingFAQ: Text Formatting FAQ This topics lists frequently asked questions on text formatting. Text formatting applies to people who edit TWiki pages in raw edit mode . TextFormattingRules...
Topic: Summary
> >
Topic: Summary:
TWikiFAQ: Frequently Asked Questions About TWiki This is a real FAQ, and also a demo of an easily implemented knowledge base solution. To see how it`s done, view the source...
TextFormattingFAQ: Text Formatting FAQ This topics lists frequently asked questions on text formatting. Text formatting applies to people who edit TWiki pages in raw edit mode . TextFormattingRules...
Topic: Summary
Table showing form field values of topics with a form
Note: Nested search can be slow, especially if you nest more then 3 times. Nesting is limited to 16 levels. For each new nesting level you need to "escape the escapes", e.g. write $dollarpercntSEARCH{ for level three, $dollardollarpercntSEARCH{ for level four, etc.
The first line sets the weekold variable to the serialized date of exactly one week ago
Changed:
< <
The SEARCH has a deferred CALC. The $percnt makes sure that the CALC gets executed once for each search hit
The CALC compares the date of the topic with the weekold date
> >
The SEARCH has a deferred CALCULATE. The $percnt makes sure that the CALCULATE gets executed once for each search hit
The CALCULATE compares the date of the topic with the weekold date
If topic is older, a <nop> is returned, which gets removed at the end of the TWiki rendering process
Otherwise, the search hit is formatted and returned
Added:
> >
This example is for illustration only, it is easier to use the date="..." paramter in SEARCH to restrict the date.
To get this:
Changed:
< <
> >
The condition can be anything you like. To restrict search based on a date range it is easier to use the date="" parameter as shown in the next example.