I have a subroutine that looks like this:
sub LoadTemplate {
my %template_tags = (
path => "/var/www/cgi-bin"
);
my $filename = shift;
my $text;
local $/;
local *F;
open(F, "< $filename\0");
$text = <F>;
close(F);
$text =~ s{ %% ( .*? ) %% }
{ exists($template_tags->{$1})
? $template_tags->{$1}
: ""
}gsex;
&PrintHeaders;
print $text;
}
I call the sub in this fashion LoadTemplate("templates/tags.html");
Now, it loads the template and prints the template correctly except that it does not replace the occurance of %%path%% which is in the tags.html file. It just strips it and leaves it blank.
The template file looks like this:
<html>
<head>
<title>Tags Test Page</title>
</head>
<body>
<font size="3">This the path: %%path%%</font>
</body>
</html>
Any help would be greatly appreciated.
Later,
Paul
http://www.fullmoonshining.com for Pearl Jam Fans
sub LoadTemplate {
my %template_tags = (
path => "/var/www/cgi-bin"
);
my $filename = shift;
my $text;
local $/;
local *F;
open(F, "< $filename\0");
$text = <F>;
close(F);
$text =~ s{ %% ( .*? ) %% }
{ exists($template_tags->{$1})
? $template_tags->{$1}
: ""
}gsex;
&PrintHeaders;
print $text;
}
I call the sub in this fashion LoadTemplate("templates/tags.html");
Now, it loads the template and prints the template correctly except that it does not replace the occurance of %%path%% which is in the tags.html file. It just strips it and leaves it blank.
The template file looks like this:
<html>
<head>
<title>Tags Test Page</title>
</head>
<body>
<font size="3">This the path: %%path%%</font>
</body>
</html>
Any help would be greatly appreciated.
Later,
Paul
http://www.fullmoonshining.com for Pearl Jam Fans