Tags:
create new tag
, view all tags

Question

Is it possible to %INCLUDE% one topic into an other but also sending an URL parameter to the included topic?

Example: I've got a topic called WhatsNew which shows the recent changes of a web. This topic accepts the URL parameter limit to set the number of recent changes to be shown (.e.g WhatsNew?limit=20). In our setup, I use this topic in all our webs with an %INCLUDE% statement which works fine.

Depending on the situation, I would like to see a different number of changes displayed, hence I would have to be able to use the URL parameter in the %INCLUDE% statement. However, if I do that, I get the following error message:

 Warning: Can't find topic General.WhatsNewlimit=10
I also tried to %ENCODE% the topic to ensure that the question mark isn't lost which didn't help.

Any ideas?

Thanks for your help.

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS: Debian Etch 2.6.18-4-486
Web server: Apache 2.2.3
Perl version: 5.8.8
Client OS: Windows XP
Web Browser: Firefox 2 & IE 6
Categories: Deployment

-- MartinKaufmann - 14 Dec 2007

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

I am not quite sure what you are trying to achieve because how to include another topic with parameters is documented in TWiki.VarINCLUDE. Maybe you just need a pointer to an example? It has been added only recently to the documentation for the upcoming TWiki 4.2 release, see the fourth example in TWiki04x02.IncludeTopicsAndWebPages.

-- HaraldJoerg - 14 Dec 2007

I Think what you are wanting is what I did with the BugsContrib - see http://develop.twiki.org/~twiki4/cgi-bin/view/Bugs/Tabulator?raw=debug .

The Tabulator topic is included into a variety of topics in that Bugs web to generate query results, and that is driven either by INCLUDE params (via URLPARAM's default), or over-ridden by the URLPARAM

-- SvenDowideit - 15 Dec 2007

Thanks! These two answers helped me to understand what I should have understood before.

Just for the record, here is what I did. I adjusted the topic WhatsNew to include the %LIMIT% variable and set it to a default value.

%SEARCH{".*" web="%INCLUDINGWEB%" type="regex" nonoise="on" order="modified" limit="%URLPARAM{"limit" default="%LIMIT%"}%" reverse="on" excludetopic="Web*" format="| [[%INCLUDINGWEB%.$topic][$topic]] | $date | $percntCALC{$IF($rev > 1, r$rev, $percntN$percnt)}$percnt | $wikiusername |" }%
<!--
   * Set LIMIT = 5
-->
Additionally, I changed the %INCLUDE% statement to %INCLUDE{"Web.WhatsNew" LIMIT="10" }%.

-- MartinKaufmann - 17 Dec 2007

 
Change status to:
Topic revision: r5 - 2007-12-17 - MartinKaufmann
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.