Hello,

I'm trying to alternate the ID of rows in the forums. This is the PHP code I've developed thus far, but it isn't working. Am I missing something? Thanks!

	$setrow='rowodd'; 
	for($table as $row)
	{ 
	if($setrow=='rowodd') {
		$setrow='roweven';
		}else{
		$setrow='rowodd';
	} 
print $setrow; ">
}

Comments

sleddoggin’s picture

Although this doesn't work either (blank page), would this be a better way to format?

$setrow='rowodd'; for($table as $row);
if ($setrow=='rowodd'):
$setrow='roweven';
else:
$setrow='rowodd';
endif;
<div class="forum-post-wrapper" id="<?php print $setrow; ?>">

nevets’s picture

There is a variable $zebra that you can use, it has the values 'odd' or 'even'.

sleddoggin’s picture

Thanks!