Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. SSI calling perl script + passing dynamic parameter

SSI calling perl script + passing dynamic parameter

Scheduled Pinned Locked Moved Web Development
perlhelpjavascripthtmldatabase
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lob
    wrote on last edited by
    #1

    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 ;(

    P 1 Reply Last reply
    0
    • L lob

      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 ;(

      P Offline
      P Offline
      perlmunger
      wrote on last edited by
      #2

      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

      A 1 Reply Last reply
      0
      • P perlmunger

        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

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        Matt, thanks for your reply.You're right - capabilities of SSI are very limited , but i still successed to do what i wanted :) Here's how i do it :

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups