Re: Include statement inside of a print statement in Lite

From: Simon Kershaw (simon@kershaw.org.uk)
Date: Thu Dec 02 1999 - 22:18:21 EST


john_pallozzi@itworld.com wrote:
>
> Hello,
>
> I am having problems using an include statement and any other cgi
> envirnoment variable inside of a Lite Print statement. The html it prints
> out is simply the environment varibale statement not the value of the
> environment variable. For example the html printed out for <!--#include
> virtual='stuff.txt'--> is:
>
> <!--#include virtual='stuff.txt'-->
>
> instead of what's inside of stuff.txt

That's because files generated by CGI scripts aren't parsed by the
server for Server-Side Includes. There appears to be no way round this
that I can see. Apache for one doesn't seem to be able to be configured
to allow this. As has been mentioned you could use Lite's functionality
to include another file, but this doesn't work if that file itself
includes SSI directives.

A possible solution is to write out your html to a temporary file, then
do a redirect to that temporary file. And occasionally tidy up your temp
files.

Another ghastly solution is to write a server side client. You write
out a temporary html file, then invoke your server-side client to get
your temp file, and this in turn writes out the now SSI-parsed file to
stdout, which means that it is the stdout of your cgi so it is sent to
the real client. Then delete your temp file. Ghastly, isn't it? But this
is what I have done, though not using Lite. Writing a very simple
server-side client in Perl is not too tricky, about 50 lines of code and
most of that is set-up.

-- 
simon
simon@kershaw.org.uk
Cambridge, England
-------------------------------------------------------------------------
To unsubscribe, go to http://www.Hughes.com.au/extras/email/



This archive was generated by hypermail 2b30 : Mon Mar 04 2002 - 09:04:03 EST