Tags:
create new tag
, view all tags

Implemented: Formatted Search with $parent token

The FormattedSearch supports now a $parent and $parent(20) token that shows the parent topic.

Example: (works once TWiki.org is updated)

  • Write: %SEARCH{ "^%TOPIC%$" scope="topic" regex="on" nosearch="on" nototal="on" format="$parent" }%
  • Get (for WebHome):

Change is in SVN; the FormattedSearch doc is updated.

*** bu4/Search.pm       Fri Jul 23 00:14:59 2004
--- Search.pm   Mon Jul 26 19:30:38 2004
***************
*** 957,962 ****
--- 957,964 ----
              } elsif( $theFormat ) {
                  # free format, added PTh 10 Oct 2001
                  $tempVal =~ s/\$summary/&TWiki::makeTopicSummary( $text, $topic, $thisWebName )/geos;
+                 $tempVal =~ s/\$parent\(([^\)]*)\)/breakName( getMetaParent( $meta ), $1 )/geos;
+                 $tempVal =~ s/\$parent/getMetaParent( $meta )/geos;
                  $tempVal =~ s/\$formfield\(\s*([^\)]*)\s*\)/getMetaFormField( $meta, $1 )/geos;
                  $tempVal =~ s/\$formname/_getMetaFormName( $meta )/geos;
                  $tempVal =~ s/\$pattern\((.*?\s*\.\*)\)/getTextPattern( $text, $1 )/geos;
***************
*** 1105,1110 ****
--- 1107,1131 ----
  }

  #=========================
+ =pod
+
+ ---++ sub getMetaParent( $theMeta )
+
+ Not yet documented.
+
+ =cut
+
+ sub getMetaParent
+ {
+     my( $theMeta ) = @_;
+
+     my $value = "";
+     my %parent = $theMeta->findOne( "TOPICPARENT" );
+     $value = $parent{"name"} if( %parent );
+     return $value;
+ }
+
+ #=========================
  =pod

  ---++ sub getMetaFormField (  $theMeta, $theParams  )

-- PeterThoeny - 27 Jul 2004

This does not work with the current TWiki (4).

-- ArthurClemens - 27 Jun 2006

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2006-06-27 - ArthurClemens
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2015 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.