Tags:
create new tag
view all tags

SID-00575: How to pass parameters to a page when linking to it

Status: Answered 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

      Change status to:
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.
SupportForm
Status Answered
Title How to pass parameters to a page when linking to it
SupportCategory CategoryMissingFunctionality
TWiki version 4.2.0
Server OS Windows Server 2003
Web server Apache 2.2.4
Perl version ActivePERL 5.8.8
Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2009-10-18 - PeterThoeny
 
  • 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.