Alternate row coloring
From PunBB Resource Wiki
This little modification will add alternate row coloring to the topic list, search result (topicview) and the userlist.
Contents |
[edit]
Category list
Open index.php and find this code at line ~115
if ($cur_forum['moderators'] != '') { $mods_array = unserialize($cur_forum['moderators']); $moderators = array(); while (list($mod_username, $mod_id) = @each($mods_array)) $moderators[] = '<a href="profile.php?id='.$mod_id.'">'.pun_htmlspecialchars($mod_username).'</a>'; $moderators = "\t\t\t\t\t\t\t\t".'<p><em>('.$lang_common['Moderated by'].'</em> '.implode(', ', $moderators).')</p>'."\n"; }
Add after:
$rowbg = $rowbg == 'even' ? 'odd' : 'even';
Find this code at line ~208:
<tr<?php if ($item_status != '') echo ' class="'.$item_status.'"'; ?>>
Replace with:
<tr<?php if ($item_status != '') echo ' class="'.trim($item_status).' '.$rowbg.'"'; else echo ' class="'.$rowbg.'"'; ?>>
[edit]
Topic list
Open viewforum.php and find this code at line ~205
// Should we show the "New posts" and/or the multipage links? if (!empty($subject_new_posts) || !empty($subject_multipage)) { $subject .= ' '.(!empty($subject_new_posts) ? $subject_new_posts : ''); $subject .= !empty($subject_multipage) ? ' '.$subject_multipage : ''; }
Add after:
$rowbg = $rowbg == 'even' ? 'odd' : 'even';
Find this code at line ~208:
<tr<?php if ($item_status != '') echo ' class="'.trim($item_status).'"'; ?>>
Replace with:
<tr<?php if ($item_status != '') echo ' class="'.trim($item_status).' '.$rowbg.'"'; else echo ' class="'.$rowbg.'"'; ?>>
[edit]
Search results (topic view)
Open search.php and find this code at line ~633:
// Should we show the "New posts" and/or the multipage links? if (!empty($subject_new_posts) || !empty($subject_multipage)) { $subject .= ' '.(!empty($subject_new_posts) ? $subject_new_posts : ''); $subject .= !empty($subject_multipage) ? ' '.$subject_multipage : ''; }
Add after:
$rowbg = $rowbg == 'even' ? 'odd' : 'even';
Find this code at line ~643:
<tr<?php if ($item_status != '') echo ' class="'.trim($item_status).'"'; ?>>
Replace with:
<tr<?php if ($item_status != '') echo ' class="'.trim($item_status).' '.$rowbg.'"'; else echo ' class="'.$rowbg.'"'; ?>>
[edit]
Userlist
Find this code at line ~162:
$user_title_field = get_title($user_data);
Add after:
$rowbg = $rowbg == 'even' ? 'odd' : 'even';
Find this code at line ~166:
<tr>
Replace with:
<tr class="<?=$rowbg?>">
[edit]
The CSS
Then add this to your stylesheet (styles/imports/oxygen_cs.css):
/* A background color for the rows */ .even {background: #555} .odd {background: #444} /* A background color for the 'replies' and 'views' colums*/ .even .tc2, .even .tc3 {background: #444} .odd .tc2, .odd .tc3 {background: #333}
You can change the background color to your choice.
--FSX 10:55, 12 April 2008 (GMT)


