SID-00575: How to pass parameters to a page when linking to it
| Status: |
Answered |
TWiki version: |
4.2.0 |
Perl version: |
ActivePERL 5.8.8 |
| Category: |
CategoryMissingFunctionality |
Server OS: |
Windows Server 2003 |
Last update: |
16 years ago |
I have a Wiki with a number of identical pages, and I use the include function to simplify it, roughly:
%INCLUDE{ "StdQueryPage" CUST="abc" VENDOR="def"}%
The pages are just a number of database queries, so I really don't need to have unique pages for each of them. Is there a way to pass parameters to the standard page such that all of the calling links can call a single page with parameters? I've tried something like
[[%WEB%/StdQueryPage?CUST=abc;VENDOR=def][Query Page]]
but the linked page doesn't seem to take the parameters. (Actually, a
%QUERYSTRING%
on the linked page does show the passed parameters, but a reference to
%CUST%
in the page itself doesn't substitute the variable.)
I'm guessing that I'm missing something simple, but I've checked the documentation as well as the support topics and haven't found anything yet. Is there a way to accomplish this?
Thanks for any help!
--
DaveBartolini - 2009-10-16
Discussion and Answer
Link like this:
[[%SCRIPTURL{view}%/%WEB%/StdQueryPage?CUST=abc;VENDOR=def][Query Page]]
More at
VarSCRIPTURL.
--
PeterThoeny - 2009-10-16
Thanks for the quick reply Peter, but that didn't solve my issue.
Here is the link that I have on the calling page:
[[%SCRIPTURL{view}%/%WEB%/TestQuery?CUST=ABC][Query]]
Here is the source of the TestQuery page. The first line is really the one that I'm looking to get working. My hope is to have ABC substitute for %CUST%. The other 4 lines are just debug:
---+ %CUST% Closed Issues
URLPARAM{"CUST"} %URLPARAM{"CUST"}%
URLPARAM{"%CUST%"} %URLPARAM{"%CUST%"}%
QUERYSTRING: %QUERYSTRING%
QUERYPARAMS: %QUERYPARAMS%
And, here is the output (minus the text formatting):
%CUST% Closed Issues
URLPARAM{"CUST"} ABC
URLPARAM{"%CUST%"}
QUERYSTRING: CUST=ABC
QUERYPARAMS: CUST=ABC
Is there any way that I can have the passed parameter substitute itself for the %CUST% variable on the TestQuery page?
NOTE: if I create a page that has this source:
%INCLUDE{ "TestQuery" CUST = "ABC"}%
I get the hoped for output:
ABC Closed Issues
URLPARAM{"CUST"}
URLPARAM{"ABC"}
QUERYSTRING:
QUERYPARAMS:
Thanks again.
Dave B.
--
DaveBartolini - 2009-10-18
Don't mix
%VARIABLES% and
%URLPARAM{}%. Use either a
%INCLUDE{}% with parameters that turn into
%VARIABLES%, or point to a page with URL parameters using
%URLPARAM{}% only.
--
PeterThoeny - 2009-10-18
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.