| (Top) < Going back to start() | Rewriting our start() with Templates: > |
In the template:
<TMPL_LOOP NAME="DRINK_TYPES">
<input type='radio' name='drink_type'
value='<TMPL_VAR NAME="value">'>
<TMPL_VAR NAME="label"><br>
</TMPL_LOOP> |
In the code:
# Fill the template's variables
$template->param(DRINK_TYPES => @types); |
You must set up @types as an array of hash-references:
my @types = ( { label => 'Fine Beers', value => 'beer' }
{ label => 'Single-Malt Whiskey', value => 'rotgut' } ); |
|
CGI::Application (v.2.0) |
27 |