Tags:
create new tag
view all tags

Question

In a web we have groups of topics that have their own project theme. They don't merit a separate web but we would like to be able to have a different leftbar for each group.

So if a parent topic has many child topics we would like the child topics to inherit the parent's leftbar.

Using INCLUDE and/or IF/ELSE how can I do the following?

If parentsleftbar exists include it

else include defaultleftbar

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: RH linux
Web server: apache
Perl version: 5.8
Client OS: Windows, Mac, Linux
Web Browser: Firefox, IE, Safari
Categories: Search

-- PeterJones - 04 Oct 2007

Answer

ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.

I'm making some progress by am having trouble resolving variables

I get the parent of the topic using this search.

   * Set MYDADDY = %SEARCH{ "^%BASETOPIC%$" scope="topic" nosearch="on" type="regex" nototal="on" format="$percntCALC{$IF($EXACT($parent,), %HOMETOPIC%, $parent)}$percnt" }%

I then set a variable for the parents left bar topic

   * Set DADDYLEFTBAR = %MYDADDY%LeftBar

The problem is then including this topic as the following does not work

%INCLUDE{"%DADDYLEFTBAR%" warn="off"}%

Even the Im only 1/2 way there as I really need something like

%INCLUDE{"%DADDYLEFTBAR%" warn="%INCLUDE{"%PROJECTLEFTBAR%" warn="LeftMenuBar"}%"}%

Any ideas?

-- PeterJones - 30 Oct 2007

Suppose you have a default WebLeftBar and a MyTopicWebLeftBar. This search will find the parent of the current topic, and writes it inside an INCLUDE. The 'WebLeftBar' is appended - if nothing is found only 'WebLeftBar' is included:

%INCLUDE{"%SEARCH{ "^%BASETOPIC%$" scope="topic" nosearch="on" type="regex" nonoise="on" format="$parent" }%WebLeftBar"}%

-- ArthurClemens - 30 Oct 2007

Thanks Arthur, this is what I was looking for.

In our case the SEARCH command goes into WebLeftBar, so I had to modify it to avoid rec curing inserts of WebLeftBar itself.

So I have a parent topic TheParent that has a corresponding left bar TheParentLeftBar. All children topics of TheParent inherit the left bar with

%INCLUDE{"%SEARCH{ "^%BASETOPIC%$" scope="topic" nosearch="on" type="regex" nonoise="on" format="$parent" }%LeftBar"}%

-- PeterJones - 04 Nov 2007

Change status to:
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2007-11-04 - PeterJones
 
  • 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-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.