Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
#!/perl/bin/perl use strict; use CGI qw(-oldstyle_urls :standard); use CGI::Carp qw( fatalsToBrowser set_message ); print "Content-type: text/html\n\n "; my $input_temp = "../html/main.html"; my $include1="../includes/header.html"; my $footer1="../includes/footer.html"; open(IN, $input_temp) || print "Can't open input file1: $input_temp\n" +; while(<IN>) { if ($_ =~ /\<INCLUDE1\>/) { $_ =~ s/\<INCLUDE1\>/$include1/; } if ($_ =~ /\<INCLUDE2\>/) { $_ =~ s/\<INCLUDE2\>/$footer1/; } } close IN; __MAIN.HTML__ <html> <head> <title>Simple Test</title> </head> <body> <INCLUDE1> <div class=menu> ...stuff... </div> <div class=main> <!--content--> </div> <FOOTER> </body> </html> __HEADER.HTML___ home - about - services - etc __FOOTER.HTML___ its all about service etc
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading in html files help!
by almut (Canon) on Apr 22, 2010 at 14:43 UTC | |
|
Re: Reading in html files help!
by wfsp (Abbot) on Apr 22, 2010 at 14:40 UTC | |
by Anonymous Monk on Apr 22, 2010 at 14:59 UTC | |
|
Re: Reading in html files help!
by choroba (Cardinal) on Apr 22, 2010 at 14:36 UTC | |
by Anonymous Monk on Apr 22, 2010 at 15:32 UTC |