Alternating background colors
I just wrote some pretty quick code for the age-old problem of alternating colors in a table. I don’t know how this could get any simpler. Sweet!
<? foreach($posts as $post){?>
<div class="<?=($c++%2==1)?'odd':NULL?>“>
<?=$post?>
</div><br />
<? }?><br />
<style>
.odd{background-color:red;}<br />
</style>