Here\'s a PHP example of mine. Can anyone find a shorter/easier way to do this?
foreach($posts as $post){?>
Just for fun
Assuming you can use CSS3 selectors you can do something like
foreach($posts as $post){?>
=$post?>
}?>
Even with CSS2 support and mootools (javascript library) you can substitute the style with this javascript
If you don't have anything but php a it you can simplify a bit yous code using an array
$isodd=array('','odd');
$c=0;
foreach($posts as $post){?>
=$post?>
}?>