Alternating Rows in PunBB
After freshening up the Mint Forum I received a number of emails asking how I hacked the excellent PunBB to display alternating rows. So to save anyone else the trouble of emailing here’s the simple three line edit to the forum and topic lists, index.php and viewforum.php respectively. (These line numbers are from PunBB 1.2.11 but the logic in the modified areas shouldn’t change too much from version to version.)
Open up index.php and insert the following before the while
loop on line 46:
$alt = true;
Then, on the line after the opening {
of that same while
loop add:
$alt = !$alt;
Finally, around line 126 (above the closing ?>
) add:
if ($alt)
{
$item_status .= ' alt';
}
In viewforum.php the while
loop begins around line 141 and the closing ?>
around line 207.
With these changes in place, style the alternate rows using the following selectors:
.blocktable tr.alt td {}
.blocktable tr.inew.alt > td {}
.blocktable tr.isticky.alt > td {}
Without going into too much detail, the >
child selector is used to “hide” the more specific, multi-class alternate styles from older versions of IE PC (less than 7.0). The older IEs only “see” the last class of a multi-class single element selector. Without the child selector, the above example would result in all alternate rows looking like alternate sticky rows.
002 Comments
Thanks…
Thanks, this is good too know.