Gossamer Forum
Home : Products : DBMan : Discussions :

subs to include file don't work ;(

Quote Reply
subs to include file don't work ;(
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
Subject Author Views Date
Thread subs to include file don't work ;( Gilmarim 3008 Feb 9, 2001, 12:37 PM
Thread Re: subs to include file don't work ;(
Karen 2944 Feb 9, 2001, 1:02 PM
Thread Re: subs to include file don't work ;(
Gilmarim 2948 Feb 9, 2001, 1:07 PM
Thread Re: subs to include file don't work ;(
Karen 2941 Feb 9, 2001, 1:20 PM
Thread Re: subs to include file don't work ;(
Gilmarim 2930 Feb 9, 2001, 4:09 PM
Thread Re: subs to include file don't work ;(
Karen 2937 Feb 9, 2001, 5:45 PM
Post Re: subs to include file don't work ;(
Gilmarim 2903 Feb 10, 2001, 11:19 AM