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
--
MartinKaufmann - 14 Dec 2007
Answer
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 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