in reply to Questions on how to use CGI::FormBuilder and HTML::Template together.
<!-- TMPL_LOOP NAME='myloop' --> <fieldset class="fb_set" id="person<!-- TMPL_VAR NAME='id' -->"> <p>Your email address: <!-- TMPL_VAR NAME='email' ESCAPE='html' --> </fieldset> <!-- /TMPL_LOOP -->
Now, you need to get id and email references into an array for the template. Let's assume you have a hash called people that is indexed by id. So you'd write Perl code like this:
my $tmpl = HTML::Template->new( ... ); my @loopvar = (); foreach my $id ( keys %people ) { my $email = $people{$id}->{email}; my %rowhash = ( id => $id, email => $email, ); push( @loopvar, \%rowhash ); } $tmpl->param( myloop => \@loopvar );
|
|---|