Author Topic: Change css class on every loop  (Read 2546 times)

0 Members and 1 Guest are viewing this topic.

Offline danf.1979

  • Newbie
  • *
  • Posts: 2
Change css class on every loop
« on: Sat, 23. February 2008 - 20:32:46 »
Hi, is there any way I can manage to change colores for each row in a {tmpl_loop}? I'm trying to switch colors in a table, but I can't think of another solution than to use {tmpl_if}, but that surely doesn't seem very motivating.

Offline ClausVB

  • Administrator
  • Hero Member
  • *****
  • Posts: 560
    • Homepage: clausvb.de
Re: Change css class on every loop
« Reply #1 on: Mon, 25. February 2008 - 19:05:58 »
You have to use TMPL_IF like

Code: [Select]
<tr style="background-color: <tmpl_if name='__EVEN__'}#eeeeee<tmpl_else>#dcdcde</tmpl_if>;">
Example: Display data with changing row colors

Regards,
Claus