in reply to Re: Loop Context Style with HTML::Template
in thread Loop Context Style with HTML::Template

I would definitely go with option 3, but why not take it one step further? Rename your "__ODD__" template variable to something like "class", then store the full class name instead of just a "1" or "" in that variable.

Greetings Bird,

The problem with that is that the <TMPL_VAR name="__ODD__"> is a loop context variable. It's created and controlled by HTML::Template as the module loops through the array passed to it by reference. I don't think I can mess with it without violating some OOP law.

I could define "class" as an element of the hash of the array of the "some_loop" loop, but one of the reasons I liked the HTML::Template concept was that it didn't require me to do any such defining since the module's code handled everything.

-gryphon
code('Perl') || die;

  • Comment on Re: Re: Loop Context Style with HTML::Template

Replies are listed 'Best First'.
Re: Re: Re: Loop Context Style with HTML::Template
by Bird (Pilgrim) on Aug 03, 2002 at 13:23 UTC
    Right, sorry, I didn't realize you were so set on using the loop context variable. By creating one of my own, I provided a more versatile solution which is, as I mentioned, probably more than you need.

    Oh well... :)

    -Bird