I have a script which uses HTML::Template to throw different pages depending on the information received:
# open the HTML template my $template = HTML::Template->new(filename => $f_name); # fill in some parameters in the template $template->param(Number => $Number); $template->param(new => $new); $template->param(story => $story); $template->param(id_no => $id_no); $template->param(message_no => $message_no); if (($check == '0') or ($check == '3') or ($check == '4')) { $template->param(tart => $tart); $template->param(ear => $ear); $template->param(mouth => $mouth); } # print the template to file print $template->output;
My problem is that one of the pages does not need/contain the HTML line : <TMPL_VAR NAME="mouth">
The result is that when the template is called for that page a blank screen results
My workaround is simply to put that line into the template as a comment, and that works fine, but I thought I'd ask the question to see if there is a way of preventing the problem instead of stuffing the templates full of superfluous comments.
Thank you
PS I tried the following to no avail:
if (($check == '0') or ($check == '3') or ($check == '4')) { $template->param(tart => $tart); $template->param(ear => $ear); } if (($check == '0') or ($check == '4')) { $template->param(mouth => $mouth); }
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |