Posted By

ReeceMarsland on 11/06/09


Tagged

css php


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

vali29


Odd and Even classes


 / Published in: PHP
 

  1. $count = 0;
  2. foreach ($images as $image) {
  3. $count++;
  4. $odd_even = ceil($count);
  5. if ($odd_even % 2) {
  6. $class = 'odd';
  7. } else {
  8. $class = 'even';
  9. }
  10. $content .= '<li class="'.$class.'">';
  11. }

Report this snippet  

You need to login to post a comment.