If you only speak of two colors, it's quite easy in the template system I use (and I guess, even easier on standard Template systems).
I create an array (call it @array) on my perl program, containing hashes. One of the hash elements is named "bgcolor" and is actually a boolean value. Let's say for example that it also has a "content" value which is string and a "cnt" value which is integer (a counter).
The code notation provided works for HTMLTP, but it should work anywhere as the logical part.
<table> <!--: ascending array :--> <tr class="<!--: if bgcolor :-->colored<!--: else :-->noncolored<!--: +end :-->"><td>[:cnt:]</td><td>The content of the [:cnt:]th element is + : [:content:]</td></tr> <!--: end :--> </table>
In reply to Re^2: Code and html separation - always or mostly doable?
by Michalis
in thread Code and html separation - always or mostly doable?
by kiat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |