Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
sub index { #&top_nav; &weather; #$weatherData = weather(); #$weatherData = &weather(); #$weatherData = &weather; #$weatherData = main(); &date; #read in template page for INDEX.HTML################################# +###### my $templateFileIndex="../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 on date, nav bar and variables $tIndex=~s/%%INSERT DATE HERE%%/$liveDate/g; #my $weatherData= &weather; $tIndex=~s/%%WEATHER2%%/$test/g;#This one works jus fine I can make th +e substitution. #It doesn't work #$tIndex=~s/%%WEATHER%%/$weatherData2/g; #$tIndex=~s/%%WEATHER%%/$weatherData/g; #$tIndex=~s/%%WEATHER%%/&weather/g; #$tIndex=~s/%%WEATHER%%/$weather/g; #done, output page to browser print $tIndex; exit } ###################################################################### +###### sub weather { # read in footer template $foot="c:/progra~1/apache~1/apache/cgi-bin/weather/weather.pl"; #This +program print a weather forecast into html page template open(MYFOOT,"<$foot"); @footerPage=<MYFOOT>; close(MYFOOT); #condense page array into one scalar variable $weather=join("",@footerPage); $test="Test variable, passing value to html template"; return $weather; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Template Parsing
by davorg (Chancellor) on Sep 18, 2002 at 13:04 UTC | |
by LTjake (Prior) on Sep 18, 2002 at 13:25 UTC | |
by Anonymous Monk on Sep 18, 2002 at 13:45 UTC | |
|
Re: Template Parsing
by perrin (Chancellor) on Sep 18, 2002 at 16:46 UTC |