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
You are here: TWiki> Support Web>HowToListChildrenTopics (02 Jun 2007, PeterThoeny)
Tags:
create new tag
, view all tags

Question

I'm looking for a method to list all children topics and format it with something like " * $topic".

%METASEARCH{topic="%TOPIC%" type="parent"} %

That search would be perfect, however it isn't formatted. I've tried getting the search accomplished via %SEARCH{}%, which directly supports format="", but I can't manage to get the search to only display children topics - as the type="" doesn't support 'parent'.

Please assist.

Environment

TWiki version: TWikiRelease04x00x04
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: CentOS? 4.4
Web server: Apache 2.0.52
Perl version: 5.8.5
Client OS:  
Web Browser:  
Categories: Search

-- TWikiGuest - 27 Oct 2006

Answer

%SEARCH{ "^%BASETOPIC%$" scope="topic" web="%BASEWEB%" regex="on" nosearch="on" nototal="on" zeroresults="off" format="- $parent(15, ...) %BR%" }%
*%BASETOPIC%* %BR%
%METASEARCH{type="parent" topic="%BASETOPIC%" format="- $topic(15, ...) %BR%"}%

-- SteveStark - 07 Nov 2006

Except that the format parameter does not work yet.

-- ArthurClemens - 08 Nov 2006

You can try the TreePlugin

-- SteveStark - 21 Nov 2006

More search help in SearchPatternCookbook.

We've added the format parameter recently to METASEARCH, but that is not published yet so of little help to you now.

-- ArthurClemens - 21 Nov 2006

The following also works:

%SEARCH{"\%META:TOPICPARENT\{name=\"%TOPIC%\"\}\%" type="regex" nosearch="on" header="Children: "}%

-- TWikiGuest - 20 Dec 2006

How create a dynamic leftbar, with search e topicparent?

-- AndreMatos - 17 Apr 2007

Add above mentioned SEARCH into the WebLeftBar topics of your TWiki. Search for \"%BASETOPIC%\" instead of \"%TOPIC%\". You can format the search output as bullets with a format="   * [[$topic]]. Watch out, there is an impact in performance if you do that for every page view.

-- PeterThoeny - 17 Apr 2007

I made this:

 %SEARCH{ "^%BASETOPIC%$" scope="topic" web="%BASEWEB%" regex="on" nosearch="on" nototal="on" zeroresults="off" format="   * [[$topic]] %BR%" }%

did not give certain

Help me, please.

-- AndreMatos - 17 Apr 2007

Try this (untested):

%SEARCH{ "META:TOPICPARENT\{name=\"%BASETOPIC%\"\}" web="%BASEWEB%" type="regex" nonoise="on" header="Children:" format="   * [[$web.$topic][$topic]]" }%

-- PeterThoeny - 17 Apr 2007

I placed code in WebLeftBar.txt, but nothing did not happen. Look the code:

%INCLUDE{"%IF{"context can_login" then="%TWIKIWEB%.WebLeftBarLogin" else="<nop>"}%" warn="off"}%

   * <b>[[HomeTi][ %ICON{"home"}% <nop>%MAKETEXT{"Home"}%]]</b>
   
%SEARCH{ "META:TOPICPARENT\{name=\"%BASETOPIC%\"\}" web="%BASEWEB%" type="regex" nonoise="on" header="Children:" format="   * [[$web.$topic][$topic]]" }%"

-- AndreMatos - 17 Apr 2007

I am sending it the code in annex, through of email. Please, help me. Thanks.

-- AndreMatos - 17 Apr 2007

May be someone else can help; I do not have the bandwidth to debug the details. Also, please read the docs at VarSEARCH, FormattedSearch.

-- PeterThoeny - 17 Apr 2007

It would have as I to filter TOPICLIST, instead of SEARCH?

-- AndreMatos - 18 Apr 2007

It has as to place " excludetopic " in topiclist?

-- AndreMatos - 18 Apr 2007

How use META:TOPICPARENT{name="XXXX"} in IF of the TWIKI I used this:

%IF{"\%META:TOPICPARENT\{name=\"WebHome\"\}\%" then="%MAKETEXT{"OK"}%" else="%MAKETEXT{"Not"}%"}% and he did not give certain. I want to use as string

-- AndreMatos - 19 Apr 2007

See for a working example HierarchicalNavigation.

-- ArthurClemens - 19 Apr 2007

It did not decide my problem... I would like to load a menu dynamic. I tried for search and topiclist

-- AndreMatos - 19 Apr 2007

Closing this after more than 30 days of inactivity...

-- PeterThoeny - 02 Jun 2007

 
Change status to:
Topic revision: r19 - 02 Jun 2007 - 07:44:18 - PeterThoeny
 
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