We relaunched the TWiki.org project with an expanded TWiki charter, and we invite you to participate! The TWiki.org Code of Conduct agreement took effect on 27 Oct 2008. We ask existing twiki.org users to opt-in. You need to opt-in to participate in the Blog, Codev, Plugins and TWiki webs. -- PeterThoeny - 27 Oct 2008
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

Topic revision: r2 - 27 Jun 2006 - 00:08:47 - ArthurClemens
 
TWIKI.NET
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