Forum Moderators: coopster & phranque

Message Too Old, No Replies

SSI calling perl script + passing dynamic parameter

have question

         

Foreva

3:25 pm on Feb 26, 2004 (gmt 0)

10+ Year Member



Hi,

I'm calling for some script which displays info according to category.
This is how i do it :

<!--#include virtual="/cgi-bin/info_by_category.pl"-->

It works , but currently it always displays the same default category.
Now , the problem : I dont know what category i gonna use. It comes through URL , because the URL looks like this :

www.mydomain.com/info.html?category=1

where the number "1" can be any number from 0-9.

The perl script cant retrieve this info through
$ENV{'QUERY_STRING'}
because i call the script without any parameters.

I'd like somehow to add category number when calling
the script IN RUNTIME (!)
<!--#include virtual="/cgi-bin/info_by_category.pl?category=x"-->
where the "x" is category number passed in URL ,
but dont know if its possible.

Help needed!
Thanks in advance

I tried adding it with JavaScript but id didnt work out ;(

gettoefl

5:09 pm on Feb 27, 2004 (gmt 0)

10+ Year Member



Does this help?

<html>
<head><title>test SSI</title></head>
<body>
<div><!--#set var="which" value="$QUERY_STRING" --> </div>
<div><!--#echo var="which" --></div>
</body>
</html>

Append the variable to your script call.

Mark

Foreva

9:48 am on Feb 28, 2004 (gmt 0)

10+ Year Member



gettoefl,

Its pretty clear that i can display query string in THE SAME page. The question is how can i pass it to my script.

Can i use smth like

html>
<head><title>test SSI</title></head>
<body>
<div><!--#set var="which" value="$QUERY_STRING" --> </div>
<div><!--#echo var="which" --></div>

<!--#include virtual="/cgi-bin/info_by_category.pl?category="which""-->

</body>
</html>

What's the correct syntax for it?

Foreva

2:21 pm on Feb 29, 2004 (gmt 0)

10+ Year Member



gettoefl,

Thanks , it helped!
I use such call now (with your help) :

<!--#set var="category" value="$QUERY_STRING" -->
<!--#include virtual="/cgi-bin/info_by_category.pl?$category"-->

:)