Passing argument to a SSI script

Top Japanese page




Overview

A way to pass arguments to the script executing as SSI.

Flow

  1. Invoke SSI using "include virtual"

A sample code

 <!--#include virtual="topdisp.cgi?mode=event" -->

Description of the code

 <!--#include virtual="topdisp.cgi?mode=event" -->

To execute a script with SSI, usualy

 <!--#exec cgi="script.cgi" -->

or

 <!--#exec cmd="script.cgi" -->

is used. However, in this method, it cannot pass arguments into the script. By using "include virtual", it can pass arguments as if it passed through GET and the arguments will be containted in QUERY_STRING. Therefore, the processing can be done easily by CGI.pm.

To obtain the contents directly, it can be done as follows.

 $data=$ENV{"QUERY_STRING"};