|
-
How to implement ssi in cgi...
I have severeal ssi pages (.shtml) that I want to include in the cgi output of a script.
The CGI script is main.cgi and is calling the layout from a template called master.shtml, which contains the design of the site, and a !!INSERT!! text where I want the script to insert its output.
I've tried including SSI tags in master.shtml, but this doesn't work.
Is it possible to call SSI from a CGI script that calls another page?
-
Ursus Arctos Moderatis
You can't double dip SSI.
If I understand your situation right...you have a .shtml document called "master.shtml"
Inside this document you probably have a few <!--#include file="leftnav.hhh"--> or whatever. All by itself, that works fine.
Now...in a CGI script, you're trying to include the contents of master.shtml, so it can output a proper layout?
Im a little confused on this area right here....are you trying to include master.shtml into the CGI script using a Perl command? If that's the case than no, SSI commands can't be executed in a Perl script.
Also, if you were to create a "home.shtml" which had the following include:
<!--#include file="master.shtml"-->
than the includes that lay inside of Master.shtml wouldn't be executed. this is what I meant when I said you can't "double dip".
Read why this is...is that a webpage is only read once by the server. When it comes across an SSI line, it'll execute whatever it was told to do, and then continue moving along. In this case, it's an include of the contents of a given file, so it paints that code into your home.shtml document, and continues moving along. In order for it to execute the SSI includes within the master.shtml code, it would have to go back and read everything all over again. And then it would see the SSI tags that were in the master.shtml document.
Heh, I hope that made sense.
And if part of your question was how to include the output of a CGI file,
this is the SSI code:
<!--#exec cgi="/cgi-bin/main.cgi"-->
And you need not adjust this SSI line, no matter where you place your .shtml page. The shtml page can be 10 folders deep, and this will still work. this is because this SSI command always starts from the web's Root directory.
Sorry if I had some superflous information here, but the way your question was worded, I couldn't exactly understand what you were asking. So I figured I'd cover as much as I can without going insane. 
Good luck with it.
-
Thanks!
You covered what I wanted to know, the double dip thing, and the question about executing SSI from CGI.
I probably have to figure out another way to solve my problem then.
-
Ursus Arctos Moderatis
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|