HTML::Template and __ODD__

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I have the following code in one of my template files

<tbody id='interfaceData'>
  <!-- TMPL_LOOP NAME="interfaceData" -->
  <tr <!-- TMPL_IF NAME="__ODD__" -->class="alternateRow"<!-- /TMPL_IF --> >
    <td><!-- TMPL_VAR NAME="interface" --></td>
    <td><!-- TMPL_VAR NAME="if_type_description" --></td>
      <a href='efs.cgi?rm=listInterfaceDetails;&amp;interface_id=<!--
TMPL_VAR NAME="interface_id" -->'
  <!-- /TMPL_LOOP -->

The loop works, all the variables insert properly. The only thing that
doesn't happen is the alternate row class style being applied to odd rows
in the table. All I get is the tag "<tr >" appearing on each row.

Could anyone clue me up as to where I am going wrong?

Colin Walls

Remove the pink meat to mail me

Re: HTML::Template and __ODD__

Quoted text here. Click to load it

Your code looks fine to me so my deduction would be that the __ODD__
is not present and that's why you're getting a blank in the "<tr >".
The most obvious cause of this would be that you've forgotten to set
the loop_context_vars parameter to a true value when calling
HTML::Template->new() or one of its sisters.

By the way, there's a mailing list for HTML::Template here:

James Taylor, London, UK                              PGP key: 3FBE1BF9
To protect against spam, the address in the "From:" header is not valid.
In any case, you should reply to the group so that everyone can benefit.
If you must send me a private email, use james at oakseed demon co uk.

Re: HTML::Template and __ODD__

James Taylor wrote:
Quoted text here. Click to load it

Thanks for that, a case of RTFM. My only excuse is that I was using
templates via CGI::Application.

Mea culpa, mea culpa, mea maxima culpa.

Colin Walls

Remove the pink meat to mail me

Site Timeline