Tags:
create new tag
view all tags

Question

How do I get the parent of the current topic to display on the page?

%META{"parent"}% doesn't seem to work here at TWiki.org or on my server.

  • TWiki version: Dec 2001
  • Web server:
  • Server OS:
  • Web browser:
  • Client OS:

-- CoreyFruitman - 17 Apr 2002

Does anyone know the answer to this ? How do we get meta information rendered from within the topic text ? I can't get :

%<nop>META{"parent"}%

To work either. Help appreciated.

-- SteveJonesST - 30 Jun 2005

I can't see any %META variable doccoed in TWikiVariables - though I also can't see what (other than a SEARCH) would give you that value at the mo

%PARENT% , %VAR(PARENT)%

-- SvenDowideit - 30 Jun 2005

Hi Sven, thanks for your comments - I was referring to the documentation at TWikiMetaData.

It looks as if the %META% variables are only expanded in templates, not in topic text, and I wondered if there was a good reason for this, and if there was a way to force rendering of this metadata.

Any suggestions welcome.

Thanks,

-- SteveJonesST - 01 Jul 2005

Answer

You cannot get meta information on a topic page. Only in templates.

-- ArthurClemens - 01 Jul 2005

Yes, but why - I suppose there is a good reason, but I am interested to understand.

-- SteveJonesST - 01 Jul 2005

Can't this be done by a simple regex search for %META:TOPICPARENT{name="?

-- FranzJosefSilli - 01 Jul 2005

Franz, can you post an example here ? What I'm trying to do is create a link to the parent of this topic, so that when I click on this link I see the parent. If you have something which works, I would be very grateful.

-- SteveJonesST - 01 Jul 2005

I thought this would be a breeze and so I came up with the following search:

%SEARCH{"%TOPIC%" nototal="on" nosearch="on" noheader="on" web="%WEB%" scope="topic" format="$pattern(.*?[M]ETA:TOPICPARENT.*?\"(.*?)\".*)" }%
Unfortunately, it doesn't work and I can't figure out why. frown Maybe some regex-guru out there can enlighten us.

-- LynnwoodBrown - 01 Jul 2005

AFAIK this is currently not possible since a pattern search is applied to the main body text excluding meta data.

The TWikiRelease01Sep2004 added a $parent to the FormattedSearch.

The next step is to make topic meta data available with an easier syntax as proposed in ContentAccessSyntax.

-- PeterThoeny - 02 Jul 2005

Thanks all for your help. With a small refinement of LynnwoodBrown's search, I can get to the parent of this topic :

%SEARCH{ "^%BASETOPIC%$" scope="topic" nosearch="on" type="regex" nototal="on" format="[[$parent][parent_link]]" }%

This has enabled me to build a small navigation pane for a structured web, using the tree plugin : docnav.gif

I am very grateful for all your help.

-- SteveJonesST - 05 Jul 2005

The [[$parent][parent_link]] link probably fails if the topic has no parent set ($parent will be empty). You can use some SpreadSheetPlugin magic to conditionally link to the parent or to WebHome.

Untested example format: [[$percntCALC{$IF($EXACT($parent,), %HOMETOPIC%, $parent)}$percnt][parent_link]]

-- PeterThoeny - 02 Jul 2005

Looks good, Steve. Would you share this?

-- ArthurClemens - 06 Jul 2005

Peter is correct as usual - his spreadsheet formula handles orphan topics gracefully - thanks.

I have posted an example of the navigator pane code at TopicNavPane. I INLCUDE this at the top of every topic to get it to display at the top right of each page.

Unfortunately, the TreePlugin is not installed at twiki.org, so you don't see the tree displayed. I haven't uploaded the icons or the images for the rounded corners, but you get the idea.

Comments and improvements are welcome.

-- SteveJonesST - 07 Jul 2005

I've added the Search pattern to SearchPatternCookbook

Nice navigation pane! Could you upload the missing graphics and make a TreePluginNavigationPaneAddOn page for it? It's great examples like this that show the PowerOfTWiki!

-- JosMaccabiani - 10 Jul 2005

Warnings about leveraging TreePlugin:

  1. TreePlugin is not, I don't believe, well maintained
  2. TreePlugin is a VERY expensive plugin in terms of resource useage. A TWiki-ite just posted some benchmarks that confirm what I commented on over a year ago -- that for large webs it is a resource hog.

My 2cents.

-- SteveRJones - 13 Jul 2005

Maybe the new DirectedGraphWebMapPlugin does scale better and could be told to do also trees not maps only, cause trees are simply graphs too, aren't they? wink

-- FranzJosefSilli - 14 Jul 2005

Topic attachments
I Attachment History Action Size Date Who Comment
GIFgif docnav.gif r1 manage 15.6 K 2005-07-05 - 09:33 UnknownUser docnav image
Edit | Attach | Watch | Print version | History: r20 < r19 < r18 < r17 < r16 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r20 - 2005-07-14 - FranzJosefSilli
 
  • 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-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.