Welcome, Registration, and other StartingPoints; TWiki history & Wiki style; All the docs...
View   r13  >  r12  >  r11  >  r10  >  r9  >  r8  ...
FormattedSearch 13 - 17 Mar 2004 - Main.PeterThoeny
Line: 1 to 1
 
META TOPICPARENT name="TWikiVariables"
Line: 24 to 24
 Variables that can be used in the format string:

Name: Expands To:
Changed:
<
<
$web Name of the web(s), separated by commas, or 'all'
>
>
$web Name of the web
 
$topic Topic name
$topic(20) Topic name, "- " hyphenated each 20 characters
$topic(30, -<br />) Topic name, hyphenated each 30 characters with separator "-<br />"
$topic(40, ...) Topic name, shortended to 40 characters with "..." indication
$text Formatted topic text. In case of a multiple="on" search, it is the line found for each search hit.
$locked LOCKED flag (if any)
Changed:
<
<
$date Time stamp of last topic update, like 28 Nov 2024 - 16:34
$isodate Time stamp of last topic update, like 2024-11-28T16:34Z
$rev Number of last topic revision, like 1.4
$username Login name of last topic update, like jsmith
$wikiname Wiki user name of last topic update, like JohnSmith
>
>
$date Time stamp of last topic update, e.g. 28 Nov 2024 - 16:34
$isodate Time stamp of last topic update, e.g. 2024-11-28T16:34Z
$rev Number of last topic revision, e.g. 1.4
$username Login name of last topic update, e.g. jsmith
$wikiname Wiki user name of last topic update, e.g. JohnSmith
 
$wikiusername Wiki user name of last topic update, like Main.JohnSmith
Added:
>
>
$createdate Time stamp of topic revision 1.1
$createusername Login name of topic revision 1.1, e.g. jsmith
$createwikiname Wiki user name of topic revision 1.1, e.g. JohnSmith
$createwikiusername Wiki user name of topic revision 1.1, e.g. Main.JohnSmith
 
$summary Topic summary
Added:
>
>
$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
$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, shortended to 30 characters with "..." indication
Changed:
<
<
$pattern(reg-exp) A regular expression pattern to extract some text from a topic. In case of a multiple="on" search, the pattern is applied to the line found in each search hit. For example, $pattern(.*?\*.*?Email\:\s*([^\n\r]+).*) extracts the email address from a bullet of format * Email: ....
>
>
$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. The pattern must cover the whole text (topic or line). For example, $pattern(.*?\*.*?Email\:\s*([^\n\r]+).*) extracts the email 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.
 
$n or $n() New line
$nop or $nop() Is a "no operation". This variable gets removed; useful for nested search
$quot Double quote ("). Alternatively write \" to escape it
Line: 110 to 115
 
  • First search:
    • %SEARCH{ "culture" format="   * $topic is referenced by: (list all references)" nosearch="on" nototal="on" }%
  • Second search. For each hit we want this search:
Changed:
<
<
    • %SEARCH{ "(topic found in first search)" format="   $topic" nosearch="on" nototal="on" }%
>
>
    • %SEARCH{ "(topic found in first search)" format="$topic" nosearch="on" nototal="on" separator=", " }%
 
  • Now let's nest the two. We need to escape the second search, e.g. the first search will build a valid second search string. Note that we escape the second search so that it does not get evaluated prematurely by the first search:
    • Use $percnt to escape the leading percent of the second search
    • Use \" to escape the double quotes
Line: 119 to 124
 Write this:
Changed:
<
<
%SEARCH{ "culture" format="   * $topic is referenced by:$n      * $percntSEARCH{ \"$topic\" format=\"   $dollartopic\" nosearch=\"on\" nototal=\"on\" }$nop%" nosearch="on" nototal="on" }%
>
>
%SEARCH{ "culture" format="   * $topic is referenced by:$n      * $percntSEARCH{ \"$topic\" format=\"$dollartopic\" nosearch=\"on\" nototal=\"on\" separator=\", \" }$nop%" nosearch="on" nototal="on" }%
 To get this:
Changed:
<
<
>
>
 

Most recently changed pages

Line: 135 to 140
 
TWikiRegistration EbenMoglen 01 Sep 2024 - 11:14
WebPreferences EbenMoglen 09 Nov 2020 - 00:30
TWikiPreferences EbenMoglen 04 Sep 2014 - 00:22
NewUserTemplate IanSullivan 08 Nov 2012 - 20:08
BlackListPlugin IanSullivan 13 Jan 2012 - 22:38
TWikiWebSideBar IanSullivan 09 Apr 2009 - 21:02
WebLeftBar IanSullivan 09 Apr 2009 - 20:37
Changed:
<
<
-- TWiki:Main.PeterThoeny - 15 Dec 2003
>
>

Embedding search forms to return a formatted result

Use an HTML form and an embedded formatted search on the same topic. You can link them together with an %URLPARAM{"..."}% variable. Example:

Write this:

<form action="%SCRIPTURLPATH%/view%SCRIPTSUFFIX%/%WEB%/%TOPIC%">
Find Topics: 
<input type="text" name="q" size="32" value="%URLPARAM{"q"}%" />
<input type="submit" value="Search" />
</form>
Result:
%SEARCH{ search="%URLPARAM{"q"}%" format="   * $web.$topic: %BR% $summary" nosearch="on" }%

To get this:

Find Topics:
Result:
Number of topics: 0

-- TWiki:Main.PeterThoeny - 16 Mar 2004


FormattedSearch 12 - 16 Dec 2003 - Main.PeterThoeny
Line: 1 to 1
 
META TOPICPARENT name="TWikiVariables"
Line: 24 to 24
 Variables that can be used in the format string:

Name: Expands To:
Changed:
<
<
$web Name of the web
>
>
$web Name of the web(s), separated by commas, or 'all'
 
$topic Topic name
$topic(20) Topic name, "- " hyphenated each 20 characters
$topic(30, -<br />) Topic name, hyphenated each 30 characters with separator "-<br />"
Line: 125 to 125
 
Added:
>
>

Most recently changed pages

 
Changed:
<
<
-- PeterThoeny? - 16 May 2002
>
>
Write this:

%SEARCH{ "\.*" scope="topic" regex="on" nosearch="on" nototal="on" order="modified" reverse="on"  format="| [[$topic]] | $wikiusername  | $date |" limit="7" }%

To get this:

TWikiRegistration EbenMoglen 01 Sep 2024 - 11:14
WebPreferences EbenMoglen 09 Nov 2020 - 00:30
TWikiPreferences EbenMoglen 04 Sep 2014 - 00:22
NewUserTemplate IanSullivan 08 Nov 2012 - 20:08
BlackListPlugin IanSullivan 13 Jan 2012 - 22:38
TWikiWebSideBar IanSullivan 09 Apr 2009 - 21:02
WebLeftBar IanSullivan 09 Apr 2009 - 20:37

-- TWiki:Main.PeterThoeny - 15 Dec 2003


FormattedSearch 11 - 29 Sep 2003 - Main.PeterThoeny
Line: 1 to 1
 
META TOPICPARENT name="TWikiVariables"
Line: 29 to 29
 
$topic(20) Topic name, "- " hyphenated each 20 characters
$topic(30, -<br />) Topic name, hyphenated each 30 characters with separator "-<br />"
$topic(40, ...) Topic name, shortended to 40 characters with "..." indication
Changed:
<
<
$text Formatted topic text
>
>
$text Formatted topic text. In case of a multiple="on" search, it is the line found for each search hit.
 
$locked LOCKED flag (if any)
$date Time stamp of last topic update, like 28 Nov 2024 - 16:34
$isodate Time stamp of last topic update, like 2024-11-28T16:34Z
Line: 42 to 42
 
$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, shortended to 30 characters with "..." indication
Changed:
<
<
$pattern(reg-exp) A regular expression pattern to extract some text from a topic. For example, $pattern(.*?\*.*?Email\:\s*([^\n\r]+).*) extracts the email address from a bullet of format * Email: ....
>
>
$pattern(reg-exp) A regular expression pattern to extract some text from a topic. In case of a multiple="on" search, the pattern is applied to the line found in each search hit. For example, $pattern(.*?\*.*?Email\:\s*([^\n\r]+).*) extracts the email address from a bullet of format * Email: ....
 
$n or $n() New line
$nop or $nop() Is a "no operation". This variable gets removed; useful for nested search
$quot Double quote ("). Alternatively write \" to escape it

FormattedSearch 10 - 08 Sep 2003 - Main.PeterThoeny
Line: 1 to 1
 
META TOPICPARENT name="TWikiVariables"
Line: 34 to 34
 
$date Time stamp of last topic update, like 28 Nov 2024 - 16:34
$isodate Time stamp of last topic update, like 2024-11-28T16:34Z
$rev Number of last topic revision, like 1.4
Added:
>
>
$username Login name of last topic update, like jsmith
$wikiname Wiki user name of last topic update, like JohnSmith
 
$wikiusername Wiki user name of last topic update, like Main.JohnSmith
Deleted:
<
<
$username User name of last topic update, like JohnSmith
 
$summary Topic summary
$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
$formfield(name, 10) Form field value, "- " hyphenated each 10 characters

FormattedSearch 9 - 13 Aug 2002 - Main.PeterThoeny
Line: 1 to 1
 
META TOPICPARENT name="TWikiVariables"
Line: 14 to 14
 1. header="..." parameter
Changed:
<
<
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.
Example: header="| *Topic:* | *Summary:* |"
>
>
Use the header parameter to specify the header of a search result. It should correspond to the format of the format parameter. This parameter is optional.
Example: header="| *Topic:* | *Summary:* |"
 2. format="..." parameter

Revision 13r13 - 17 Mar 2004 - 06:55:00 - PeterThoeny?
Revision 12r12 - 16 Dec 2003 - 07:39:28 - PeterThoeny?
Revision 11r11 - 29 Sep 2003 - 00:32:53 - PeterThoeny?
Revision 10r10 - 08 Sep 2003 - 05:24:47 - PeterThoeny?
Revision 9r9 - 13 Aug 2002 - 16:46:44 - PeterThoeny?
Revision 8r8 - 17 May 2002 - 06:57:28 - 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.
Syndicate this site RSSATOM