-
Heres a quick and simple way.
CSS:
Code:
tr#even { background-color:#C3D9FF; }
PHP:
PHP Code:
<?php
$tablerow_count=0;
function tablerowswitch() {
global $tablerow_count;
$tablerow_count++;
if ($tablerow_count % 2) {
echo "odd";
}
else {
echo "even";
}
}
?>
And set the id to this:
PHP Code:
id="tablerowswitch()"
-
Quote:
Originally Posted by
NXArmada
And set the id to this:
PHP Code:
id="tablerowswitch()"
That's assuming you are still in the PHP code. If you "escape" your HTML code from your PHP code, you would need to reopen the php tags.
example:
Code:
<?php
if ($something) {
?>
<div id="<?php tablerowswitch(); ?>">
<?php
}
?>
Otherwise, it would just display the text tablerowswitch() in the id of the div/table.
Hope this helps.
-
Yea well at least you get the idea lol. I should have put that in there for the new users to the PHP section.