Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Re: Re: HTML::Template question - tmpl_if

by punkish (Priest)
on Dec 15, 2003 at 01:38 UTC ( [id://314731]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: HTML::Template question - tmpl_if
in thread HTML::Template question - tmpl_if

I am not sure what your question is this time around. You write...
The above works with the template but I'm not sure if I'm missing something.
If it works, then you are not missing anything. Your template code is, though, a bit confusing. You have typed (perhaps, a typo) --
<select name="school_id"><option selected value="1"><option selected v +alue="0">Select<tmpl_loop name=options> <option value="<tmpl_var name=school_id>"><tmpl_var escape=html name=s +chool></option></tmpl_loop> </select>
Perhaps you meant --
<select name="school_id" size="1"> <option selected value="0">Select school</option> <tmpl_loop options> <option value="<tmpl_var school_id>"><tmpl_var escape=html school> +</option> </tmpl_loop> </select>
Wrt your original question, no matter how you do it, just remember that in H::T each variable is a scalar, while each loop is an array of hash(es). You'll be ok. If you want to not set anything, you can do one of two things -- turn die_on_bad_params off by setting it to 0, or better yet, make sure you set the value to an empty reference. Actually, you can do one more thing -- use tmpl_if to check for existence of a var before trying to display it. Good luck.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://314731]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-19 05:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found