Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

display hash in an html template

by rsennat (Beadle)
on Nov 03, 2005 at 10:10 UTC ( [id://505384]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

rsennat has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,
I have an hash of arrays which needs to be put into an HTML Template. So that hash of arrays may contain text value or selection box or drop down box.

I could do it but its really very complex. For each and every selection box, I need to create a TMPL VAR and display the values.

Is there a simpler way to do this??

Thanks.

Replies are listed 'Best First'.
Re: display hash in an html template
by Anonymous Monk on Nov 03, 2005 at 10:16 UTC
    print
Re: display hash in an html template
by Kanji (Parson) on Nov 03, 2005 at 10:29 UTC

    You may want to consult the FAQ section of HTML::Template's POD. Specifically...

    Q: What's the best way to create a <select> form element using HTML::Template?

        --k.


Re: display hash in an html template
by nedals (Deacon) on Nov 03, 2005 at 21:09 UTC
    Or something like this....
    my $ary_ref = [ { value=>1, text=>'val1'}, { value=>2, text=>'val2'}, ]; .. $template->param( select = $ary_ref, ... ); ### .tmpl <select> <TMPL_LOOP NAME=select> <option value="<TMPL_VAR NAME=value>"><TMPL_VAR NAME=text></TMPL_LOOP> </select>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://505384]
Approved by Corion
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.