Gossamer Forum
Home : General : Perl Programming :

Template Troubles

Quote Reply
Template Troubles
At the moment I am using two different template include methods to do the same thing. The first one is like this:
========
system1=
========
sub print1shtml {
print <<INTROHTML;
<html>
<head>
INTROHTML
} #### Print out the contents of file "1.shtml" that has been copied a subroutine file####


I then requite a library and then call this in a cgi script. However, I also have another system that simply opens a file, like this:
========
system2=
========
sub site1{
open (INC, "/home/charlie/public_html/1.shtml") or return "Can't find include file: 1.shtml";
return join ("", <INC> );
## Open file 1.shtml and include it like ssi, only with cgi
}

(This subroutine is included in part of my links system. )

So basically what I need is a piece of code that can open a file and print out the contents like in ==system 1== .

Thanks in advance.
Charlie.

[This message has been edited by Charlie (edited April 18, 2000).]
Quote Reply
Re: Template Troubles In reply to
 
Quote:
So basically what I need is a piece of code that can open a file and print out the contents

errr...

open (FILE, '/path/to/myfile.html') or die "Can't open myfile. Reason: $!";
print while (<FILE> );
close (FILE) or die "Can't close myfile. Reason: $!";

--mark
Quote Reply
Re: Template Troubles In reply to
Sorry. Complete lamer question. Smile

Thanx for the help, though. Much appreciated Mr.Badolato.
Quote Reply
Re: Template Troubles In reply to
 

--amrk