Gossamer Forum
Home : General : Perl Programming :

Including an SSI call in a CGI script

Quote Reply
Including an SSI call in a CGI script
How would I go about calling an SSI in a CGI output?

-Norm
Quote Reply
Re: Including an SSI call in a CGI script In reply to
Norm,

You don't, you just simulate it with a small subroutine like:

Code:
sub include {
open (FILE,"$file");
@lines = <FILE>;
close (FILE);
foreach $line (@lines) {
print "$line";
}
}

$file would be the location of the file to be included using the path from server root, and not from document root like SSI. Just place

&include;

where you'd normally have your SSI call, making sure you close off any print statements if you're using print qq.

Cheers,
adam