<< <


Environment variables can be printed in the content of the current
component using the echo SSI command. An example use might be to get a semi-random number included in link arguments (say, to defeat a browser cache).

Here it goes:

Insert a semi-random number with the REMOTE_PORT environment variable.
The core of the code is:

Your REMOTE_PORT = <!--#echo var="REMOTE_PORT" -->
The HTTP_KEEP_ALIVE value = <!--#echo var="HTTP_KEEP_ALIVE" -->
This outputs:
Your REMOTE_PORT = 49438
The HTTP_KEEP_ALIVE value = (none)

To see a different URL generated for this page, click here's a "dynamic" link:

<a href="<!--#echo var="SCRIPT_URI" -->?<!--#echo var="REMOTE_PORT" -->"><!--#echo var="SCRIPT_URI" -->?<!--#echo var="REMOTE_PORT" --></a>
This outputs:
http://www.arachna.com/edu/tutorials/mini/ssi/echo_var.html?49438
(click it)
Note: the number of seconds between changes might be as high as the HTTP_KEEP_ALIVE value, (none), that's when the server will time out any open connections. Your browser may timeout the connection before the server. If you click the link and the REMOTE_PORT hasn't changed, it means that the connection between page loads has been kept open.
Another semi-random number technique is to echo the date with this format:
<!--#config timefmt="%s" -->
<!--#echo var="DATE_LOCAL" -->
This outputs:
1227238431
See Date Formatting for more.

Finally, variables that have been explicitly set can also be echo'd:
The ARACHNA_TITLE value = <!--#echo var="ARACHNA_TITLE" -->
which is a variable that was explicitly set at the top of the page to the value "The SSI Test Suite: Echo Variables"

Link To This
You can link to this page by including this snippet

in your html


spidaman
© 1996-2007 Ian Kallen | Copyright Notice