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;


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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.