Question
- TWiki version: 01 Feb 2003
- Perl version: 5.00503
- Web server & version: Apache 1.3.27
- Server OS: FreeBSD
- Web browser & version: Phoenix
- Client OS: WinXP
Hope someone can help.
I'd like to use %TOC% across several topics, not over just a single topic, but I'm not sure how to wildcard the topic.
The specification says that the topic, if not given, defaults to the current topic. I've tried %TOC{".*"}% and %TOC{"*"}%...anyone know how to wildcard this?
-Ken
A little bit more information...
I found the 'parent' functionality, and made the correct assignments.
Now, I can do a METASEARCH based on these parent/child relationships to get a list...unfortunately, I'm having trouble formatting it: METASEARCH doesn't seem to have a formatting command to modify each item, so I get several space-separated anchor tags, but I can't see how to put something between them.
--
TWikiGuest - 07 Feb 2003
Answer
Hey!
WooHoo!
I took a look at ~www/twiki/lib/Twiki.pm, and noticed the handleMetaSearch function...and immediately below it the handleSearchWeb. At their hearts, both called &TWiki::Search::searchWeb, just with different parameters.
So, shooting in the dark, I added two paramters to metasearch (I
love an obvious API!):
sub handleMetaSearch
{
my( $attributes ) = @_;
my $attrWeb = extractNameValuePair( $attributes, "web" );
my $attrTopic = extractNameValuePair( $attributes, "topic" );
my $attrType = extractNameValuePair( $attributes, "type" );
my $attrTitle = extractNameValuePair( $attributes, "title" );
my $attrHeader = extractNameValuePair( $attributes, "header" );
my $attrFormat = extractNameValuePair( $attributes, "format" );
my $searchVal = "XXX";
if( ! $attrType ) {
$attrType = "";
}
my $searchWeb = "all";
if( $attrType eq "topicmoved" ) {
$searchVal = "%META:TOPICMOVED\{.*from=\\\"$attrWeb\.$attrTopic\\\".*\}%";
} elsif ( $attrType eq "parent" ) {
$searchWeb = $attrWeb;
$searchVal = "%META:TOPICPARENT\{.*name=\\\"($attrWeb\\.)?$attrTopic\\\".*\}%";
}
my $text = &TWiki::Search::searchWeb( "1", $searchWeb, $searchVal, "",
"", "on", "", "",
"", "on", "on",
"on", "on", "", "",
"", "on", "searchmeta", $attrHeader, $attrFormat
);
if( $text !~ /^\s*$/ ) {
$text = "$attrTitle$text";
}
return $text;
}
And now I can format the output of metasearch and order the children any way I need to.
-Ken
--
TWikiGuest - 07 Feb 2003