in reply to Re: Re: Re: Parsing Code
in thread Parsing Code
sub index { #&top_nav; #&weather; #$weatherData = &main; $weatherData = &weather; # $weatherData = weather(); &date; #read in template page for INDEX.HTML################################# +###### my $templateFileIndex="../htdocs/temp_test/index.html"; open(INFILE,"<$templateFileIndex"); my @templatePageIndex=<INFILE>; close(INFILE); #condense page array into one scalar variable my $tIndex=join("",@templatePageIndex); #search-and-replace variables $tIndex=~s/%%INSERT DATE HERE%%/$liveDate/g; #my $weatherData= &weather; $tIndex=~s/%%WEATHER2%%/$test/g; #tIndex=~s/%%INSERT NAV HERE%%/$navPage/g; $tIndex=~s/%%WEATHER%%/$weatherData/g; #done, output page to browser #Now when this code reads the html file to do the replacements of the +variables the $weatherData prints the code from weather.cgi not the r +esult of it, that's the problem. print $tIndex; exit } ###################################################################### +###### sub weather { # read in footer template $foot="cgi-bin/weather/weather.cgi"; open(MYFOOT,"<$foot"); @footerPage=<MYFOOT>; close(MYFOOT); #condense page array into one scalar variable $weather=join("",@footerPage); $test="test"; return $weather; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: Parsing Code
by BrowserUk (Patriarch) on Sep 17, 2002 at 20:28 UTC |