[support] trying to create zebra striping in custom block
Pierre Rineau
pierre.rineau at makina-corpus.com
Wed Jun 16 14:40:53 UTC 2010
Le mercredi 16 juin 2010 à 17:32 +0300, Fred Jones a écrit :
> > try this
> >
> > function isEven($x){if($x%2==0){return true;}else{return false;}}
> > $oddeven=1;
> >
> > print "<tr class=\"";
> > if(isEven($oddeven){print "even";}else{print "odd";})$oddeven++
> > print "\"><td>";
>
> I would say:
>
> print "<tr class=\"";
> print ($oddeven%2) ? "odd" : "even";
> $oddeven++;
> print "\"><td>";
>
> :)
>
> F
Or the condensed version:
print "<tr class=\"" . (($oddeven++ % 2) ? "odd" : "even") . "\"><td>";
I like obfuscation, this is the story of my life.
(If it does not work, add parenthesis around the $oddeven++).
Pierre.
More information about the support
mailing list