SSI calling perl script + passing dynamic parameter
-
Hi, I'm calling for some script which displays info according to category. This is how i do it : 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 (!) 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 ;(
-
Hi, I'm calling for some script which displays info according to category. This is how i do it : 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 (!) 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 ;(
Why use SSI at all if you have perl at your disposal? You're really using the wrong tool for the job here. SSI is really intended for adding simple dynamic information (e.g. dates, hit counters, document modification dates, etc.). It's support for variables, conditionals, and dynamic string manipulation (which you apparently need) are very limited if they exist at all. It seems to me that the only way to do what you want is to dynamically load your page that contains the SSI. At that point, it seems just silly to be using SSI at all. PHP or Perl itself would be much more capable to do what you want. Here's a couple of questions that may help if you're insistent on using SSI: 1. Where are you obtaining the category id from. Is it just hard coded in a hyper link? If so, then why not just make your hyperlink point the cgi itself passing the appropriate id directly? 2. Can you use perl or php along with SSI? If so, to do what you want would be as simple as:
<?php
$categoryID = $HTTP_GET_VARS["category"];
echo "<!-- #include virtual=\"/cgi-bin/info_by_category.pl?category=$categoryID\"-->\n";
?>3. Can you get rid of SSI altogether? If so, just move your perl script code into a CGI that draws everything you need and then runs the info_by_category.pl code. The url would then just be:
<a href="/cgi-bin/info_by_category.cgi?category=1">Info</a>
Let me know if you need any clarification. Best Regards. -Matt ------------------------------------------ The 3 great virtues of a programmer: Laziness, Impatience, and Hubris. --Larry Wall
-
Why use SSI at all if you have perl at your disposal? You're really using the wrong tool for the job here. SSI is really intended for adding simple dynamic information (e.g. dates, hit counters, document modification dates, etc.). It's support for variables, conditionals, and dynamic string manipulation (which you apparently need) are very limited if they exist at all. It seems to me that the only way to do what you want is to dynamically load your page that contains the SSI. At that point, it seems just silly to be using SSI at all. PHP or Perl itself would be much more capable to do what you want. Here's a couple of questions that may help if you're insistent on using SSI: 1. Where are you obtaining the category id from. Is it just hard coded in a hyper link? If so, then why not just make your hyperlink point the cgi itself passing the appropriate id directly? 2. Can you use perl or php along with SSI? If so, to do what you want would be as simple as:
<?php
$categoryID = $HTTP_GET_VARS["category"];
echo "<!-- #include virtual=\"/cgi-bin/info_by_category.pl?category=$categoryID\"-->\n";
?>3. Can you get rid of SSI altogether? If so, just move your perl script code into a CGI that draws everything you need and then runs the info_by_category.pl code. The url would then just be:
<a href="/cgi-bin/info_by_category.cgi?category=1">Info</a>
Let me know if you need any clarification. Best Regards. -Matt ------------------------------------------ The 3 great virtues of a programmer: Laziness, Impatience, and Hubris. --Larry Wall