Hi,
Since normal ssi calls do not work within cgi (on most servers that is) I have tried 2 different methods to include a file, both without succes. The files are there, and are already called from a .htm page (one less thing to worry about). The error message is: dbman encountered an internal error. The script does display some of the $html variables I added. Help is appreciated!
The subroutines I added in db.cgi are at the bottom of this message
Thanks a lot,
Gil
1 -
This code goes into the html.pl file.
#########################################################
## SSI Include Replacement ##
##lcr ---- see info at bottom of this file for view records ssi ##########################################################
sub include {
# --------------------------------------------------------
# This is text to include. Use like an SSI.
my $file = shift;
open (FILE, "<$file") or die "Can't open $file ($!)";
print <FILE>;
close FILE;
}
## Then add this line wherever you want file included
## |; &include ("../path/to/file"); print qq|
2 -
sub include_file {
#------------------------------------------------
open(FILE, "/path/to/file.ext") or die("Couldn't open the file.");
@lines = <FILE>;
close(FILE);
foreach $line (@lines) {
print $line;
}
}
And where you would normally put the SSI call in the HTML output, you would now put:
&include_file;
...making sure you close off any print statements first.
Thanks a lot!
Byebye
Gil
Since normal ssi calls do not work within cgi (on most servers that is) I have tried 2 different methods to include a file, both without succes. The files are there, and are already called from a .htm page (one less thing to worry about). The error message is: dbman encountered an internal error. The script does display some of the $html variables I added. Help is appreciated!
The subroutines I added in db.cgi are at the bottom of this message
Thanks a lot,
Gil
1 -
This code goes into the html.pl file.
#########################################################
## SSI Include Replacement ##
##lcr ---- see info at bottom of this file for view records ssi ##########################################################
sub include {
# --------------------------------------------------------
# This is text to include. Use like an SSI.
my $file = shift;
open (FILE, "<$file") or die "Can't open $file ($!)";
print <FILE>;
close FILE;
}
## Then add this line wherever you want file included
## |; &include ("../path/to/file"); print qq|
2 -
sub include_file {
#------------------------------------------------
open(FILE, "/path/to/file.ext") or die("Couldn't open the file.");
@lines = <FILE>;
close(FILE);
foreach $line (@lines) {
print $line;
}
}
And where you would normally put the SSI call in the HTML output, you would now put:
&include_file;
...making sure you close off any print statements first.
Thanks a lot!
Byebye
Gil