[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: Counter
Hi Kim -
> Hi, I want to make a table with products like :
> code name price
> 1 xyz1 12
> 2 abc 15
> 3 def 99
> but i want a different bgcolor for line 1., 3., 5., ... than for 2.,
> 4., ....
> How can I make a "Counter" that I can use in an if-tag or something.
You can use [calc] tags, since they remember values within a page.
Here's one way, for example:
<table>
[comment] Set the initial value to 1 [/comment]
[calc] $c = 1; ''; [/calc]
[tag each products]
[comment] Toggle the value between 1 and -1 for each row,
output a color accordingly: [/comment]
<tr bgcolor="#[calc]
$c *= -1;
($c > 0) ? 'cccccc' : 'ffffcc';
[/calc]">
<td>[loop-code]</td>
</tr>
[/tag]
</table>
Larry Leszczynski
larryl@furph.com
--
furph, Inc. WWW/Unix/Windows Solutions 734-513-7763 (voice)
info@furph.com http://www.furph..com 734-513-7759 (FAX)
- References:
- Counter
- From: Kim Armann <kim@nichols.de>