RonW is correct - what you are trying will not work. You would be better setting the class in Perl:
my $rows;
my $class = 'odd';
for my $name ( qw(Odd1 Even1 Odd2 Even2) ) {
my $hash = {
name => $name,
class => 'row_color_'.$class,
};
push(@$rows,$hash);
$class = ( $class eq 'even' ? 'odd' : 'even');
}
$template->param(DATA => $rows);
Then in your template:
<TMPL_LOOP NAME=DATA>
<tr>
<td class="<TMPL_VAR NAME="class">"> Row <TMPL_VAR NAME="name"></td>
</tr>
</TMPL_LOOP>
Output:
<tr>
<td class="row_color_odd"> Row Odd1</td>
</tr>
<tr>
<td class="row_color_even"> Row Even1</td>
</tr>
<tr>
<td class="row_color_odd"> Row Odd2</td>
</tr>
<tr>
<td class="row_color_even"> Row Even2</td>
</tr>
|