Like Alex said, its really up to what you want the SSI to do. If you are including simple text or HTML from a file, using the method for opening and outputing the file is fine.
However, if you are trying to input info outputted from another script, you may need to do alot of modifications. The reason for this is simply that a Web Server (like Apache) won't parse the HTML coming from yout CGI for SSI's embedded in the text output.
Also note that many CGI's when parsed through an SSI call have the Content header stripped by the web server. Its important, because you may end up outputting stuff like:
Quote:
Content-type:text/html
<HTML><BODY>Blah blah blah
foo foo foo
<!-- START MY INCLUDE -->
Content-type:text/html
<HTML><BODY>bar bar bar</BODY></HTML>
<!-- END OF INCLUDE -->
More Info
</BODY></HTML>
This is really a pain on Netscape which will shut down further output of your page after the first </HTML> tag. To alleviate this, you must change your initial script so that ONLY straight HTML is outputted and not header information.
Several ways to defeat this problem:
1) Execute the program you want to output as an SSI from within the CGI you are running:
print `/home/foo/public_html/cgi-bin/bar.cgi`;
** Keep in mind, you must use left quotes here, not right ones.
2) Paste in the code of the program you wish to include. Alot of banner programs already allow for this, and its not a good idea to do if the program you want to include is more than 5 to 10 thousand lines.
3) REQUIRE/USE the accompanying CGI and call the appropriate subroutine from within the program you wish to use.
------------------
Fred Hirsch
Web Consultant & Programmer