if ($counter%2==0) { $post[backcolor]="{firstaltcolor}"; $post[bgclass] = "alt1"; } else { $post[backcolor]="{secondaltcolor}"; $post[bgclass] = "alt2"; }