Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: HTML:Template Limitation?

by digger (Friar)
on Mar 18, 2003 at 20:27 UTC ( [id://244144]=note: print w/replies, xml ) Need Help??


in reply to HTML:Template Limitation?

I wanted to post the offending section of the template here to see if others could confirm the side effect I experienced.
<select name="type"> <tmpl_loop name="TYPE"> <option value="<tmpl_var name="n_event">" <t +mpl_var name="sel">> <tmpl_var name="t_event"> </option> </tmpl_loop> </select>

If I change the TMPL_LOOP name to ETYPE, everthing works as expected. It appears that if the TMPL_LOOP has the same name as the select, some type of error occurs, but the error log doesn't show anything definite.

Am I off base in my interpretation?

--digger

Replies are listed 'Best First'.
Re: Re: HTML:Template Limitation?
by cfreak (Chaplain) on Mar 18, 2003 at 20:35 UTC

    It shouldn't matter to HTML::Template what your select's name is. For consistancy I often name my form names, tmpl names all the same as my database column names and I've never had a problem with it.

    From your small snippet of code I can't really spot an error, it could be in your perl code itself. at any rate I'd suggest joining the HTML-Template-Users list (html-template-users@lists.sourceforge.net) and asking your question there. The author frequents the list and there are lots of other smart people (smarter than me) that would probably be able to tell you.

    Lobster Aliens Are attacking the world!
Re: Re: HTML:Template Limitation?
by ChemBoy (Priest) on Mar 19, 2003 at 16:40 UTC

    Am I off base in my interpretation?
    I suspect so, but it's hard to say without a better look at the actual code in context that produces the error. I tried this template fragment out with some basic code to fake up the data, and got no errors (code and output below). Assuming that you can run this code without errors, can you try to find and post the shortest piece of code and template you can come up with that does produce the error you're seeing?

    #!/usr/bin/perl use strict; use warnings; use Carp 'verbose'; use HTML::Template; my $temp_text = <<EOT; <select name="type"> <tmpl_loop name="TYPE"> <option value="<tmpl_var name="n_event">" <tmpl_var name +="sel">> <tmpl_var name="t_event"> </option> </tmpl_loop> </select> EOT my $tpl = HTML::Template->new(scalarref => \$temp_text); my @ary = map {n_event => $_, sel=>$_,t_event=>$_}, qw(foo bar baz cliche trope); $tpl->param(TYPE=>\@ary); print $tpl->output; __END__ <select name="type"> <option value="foo" foo> foo </option> <option value="bar" bar> bar </option> <option value="baz" baz> baz </option> <option value="cliche" cliche> cliche </option> <option value="trope" trope> trope </option> </select>



    If God had meant us to fly, he would *never* have given us the railroads.
        --Michael Flanders

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-18 04:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found