Lori713 has asked for the wisdom of the Perl Monks concerning the following question:
HTML::Template->output() : fatal error in loop output : HTML::Template : Attempt to set nonexistent parameter '6' - this parameter name doesn't match any declarations in the template file : (die_on_bad_params => 1) at /usr/local/lib/perl5.8.0/site_perl/HTML/Template.pm line 2905 at /local/www/htdocs/scripts/campus/radio.pl line 31
For the life of me, I can't figure out why it's not happy. I can add or subtract key/value pairs, and the error message line reference just moves up/down accordingly. Any help would be appreciated! (I've cut this example code down to a bare minimum; the original HTML code without TMPL_LOOP worked okay but was lengthy with lots of repetition. Given my customers' penchant for changing stuff, I like the idea of control tables so I have to make changes in only ONE place in my code). Thanks!
radio.pl
radio.tmpl#!/usr/local/bin/perl5_8 use strict; use HTML::Template; $|=1; print "content-type: text/html\n\n"; my $template = HTML::Template->new( filename => 'radio.tmpl' ); ############################### Begin Section ###################### #Control table used to generate report radio buttons, rpt titles... #template vars: key->Rpt no. (rpt_no); value->Rpt Descr (rpt_descr) my %rpt_tbl = ( '1' => 'Fiscal Year-to-Date Financial Information' ,'2' => 'QTD/PTD Financial Information' ,'3' => 'Cash Balance' ,'4' => 'Financial Status' ,'5' => 'Financial Summary Status' ,'6' => 'Summary by Phase' ,'7' => 'Summary by Segment' ); my (@radio_loop, $key); foreach $key ( sort keys %rpt_tbl ) { $rpt_tbl{rpt_no} = $key; $rpt_tbl{rpt_descr} = $rpt_tbl{$key}; push(@radio_loop, \%rpt_tbl); } #+++++++++++++++++++++++++++++++ End Section ++++++++++++++++++++++++ $template->param(radio=>\@radio_loop); print $template->output();
<html> <head> <title>NCSU Campus Financials Reporting</title> <meta http-equiv="Pragma" content="no-cache"> <style type="text/css"> td.welc { font: bold 10pt "Arial"; color:black; text-align:le +ft; } </style> </head> <form name="frm_mainmenu" method="post" action="nc_rpt_summary.pl"> <table border="0" width="100%" summary="Input Form"> <tr> <td class=welc width="10%" rowspan="7" valign="top">Step 1:</td> <td class=welc width="20%" rowspan="7" valign="top">Select a Report</t +d> <td class=welc width="70%" id="rpt1form"> <TMPL_LOOP NAME=radio> <input type="RADIO" name="rpt_id" value="<TMPL_VAR NAME=rpt_no>_su +mm" onclick="1" onfocus='frm_mainmenu.rptname.value="Report <TMPL_VAR NAME= +rpt_no>";'> <span style="cursor:pointer;cursor:hand" onclick='window.open("../c2/descrs.html#Rpt<TMPL_VAR NAME=r +pt_no>Descr", "myWindow", "width=650,height=600,top=10,left=10,sc +rollbars=yes");'> Report <TMPL_VAR NAME=rpt_no> - <TMPL_VAR NAME= +rpt_descr> </span></td> <tr> <td class=welc> </TMPL_LOOP> </td></tr></table></form> </body></html>
Lori
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTML::Template, TMPL_LOOP problem
by LTjake (Prior) on Dec 10, 2003 at 14:18 UTC | |
|
Re: HTML::Template, TMPL_LOOP problem
by blokhead (Monsignor) on Dec 10, 2003 at 14:19 UTC | |
|
Re: HTML::Template, TMPL_LOOP problem
by amphiplex (Monk) on Dec 10, 2003 at 14:19 UTC | |
|
Re: HTML::Template, TMPL_LOOP problem
by Lori713 (Pilgrim) on Dec 10, 2003 at 14:37 UTC |