Hi Monks!
I am trying to insert some simple html files into another html file that I use as a template
and I am not having any luck, I am read in the $input_temp and the substitution displays the
path and not the content of the files, how could I make this thing work, any help or suggestions would be great!
I included samples of the html files so you can understand what I am trying to do, thanks for looking!
#!/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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.