From: Sam Tregar <[EMAIL PROTECTED]> >I don't think this is too much code to expect people to write: > > $row{__selected__} = "selected" if $value; > >That's really all you're talking about, right?
Does %row have special meaning in HTML::Template? I saw it used in another example. I don't know if I misunderstand something about this example. (How would I use $row{__selected__} after I set it?) What I was getting at is that something seems to be missing in TMPL_LOOP. There are two types of loops which are common, have a known/standard requirement (testing for "selected" or "checked" on every row), and the syntax for accomplishing this is always referred to as "ugly." If it's so common, so standard, and so ugly, why can't there be a way that H::T handles it behind the scenes? For example, what if H::T could recognize a special keyword (such as TMPL_LOOP_SELECTED and TMPL_LOOP_CHECKED) inside the TMPL_LOOP and automatically test an array of booleans with a reserved name (say, @__selected__) who's index corresponds to H::T's internal row counter. H::T could fill in the "selected" or "checked" value if all the conditions are correct. I don't understand why there's a known requirement to produce HTML like this, but it always seems to be pushed outside the domain of H::T. If it's just a matter of ugly template syntax, couldn't the syntax be simplified by being standardized as a common processing method? >Because CGI.pm already has it nailed. Why reinvent the wheel? And >you can't beat the simplicity: > > <tmpl_var year_select> Doesn't this move the HTML out of the template? If I have class attributes that may change depending on visitor preferences, now I have to maintain them in two places (in the template for everything except SELECT and RADIOBOX elements, and in my Perl code for these two)? Mark ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click _______________________________________________ Html-template-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/html-template-users