I have a template thing going on but I need to include in the html template a cgi program for weather. In the program that calls for all the templates I have to call this weather.cgi and display on the html page, how can I do that?
I know the way it's done now is wrong but someone could help me with that by looking at the code, I hope!.
Thanks a lot!!!!
sub index
{
#&top_nav;
&weather;
&date;
#read in template page for INDEX.HTML#################################
+######
my $templateFileIndex="../../htdocs/temp_test/ia_index.html";
open(INFILE,"<$templateFileIndex");
my @templatePageIndex=<INFILE>;
close(INFILE);
#condense page array into one scalar variable
my $tIndex=join("",@templatePageIndex);
#search-and-replace on date, nav bar and variables
$tIndex=~s/%%INSERT DATE HERE%%/$liveDate/g;
#$tIndex=~s/%%BLURB%%/$blurb/g;
#$tIndex=~s/%%AGENT_NAME%%/$agent_name/g;
#$tIndex=~s/%%URL%%/$url/g;
$tIndex=~s/%%WEATHER%%/$weather/g;
$tIndex=~s/%%WEATHER2%%/$test/g;
#tIndex=~s/%%INSERT NAV HERE%%/$navPage/g;
#done, output page to browser
print $tIndex;
exit
}
######################################################################
+######
sub weather
{
# read in footer template
$foot='weather/weather.cgi';
open(MYFOOT,"<$foot");
@footerPage=<MYFOOT>;
close(MYFOOT);
#condense page array into one scalar variable
$weather=join("",@footerPage);
$test="Test Variable";
}
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.