Alternating Row Color on ForumHome

by Shadab

On Forumhome and many other areas where data is displayed in vBulletin, columns are displayed in alternate background colors (controlled by .alt1 and .alt2 classes). Some users & webmasters prefer to have alternating background in table rows instead. Achieving this effect on ForumHome requires just one template edit.

We'll utilize a native vBulletin function exec_switch_bg() to alternate the classes. You can read more about this function in the online vBulletin API.

Alternating Row Colors on vBulletin ForumHome:
Alternating Row Colors on vBulletin ForumHome

1. Go to: AdminCP » Styles & Templates » Style Manager

2. Click on the Expand Templates [« »] button for the skin which you want to edit; and then expand the Forum Home Templates group.

forumhome_forumbit_level2_post

3. Double click on the forumhome_forumbit_level2_post list item to edit that template.

4. ADD the code shown in the first line, and EDIT all instances of alt1 and alt2 to $GLOBALS[bgclass] as highlighted below:

<if condition="exec_switch_bg()"></if>

<tr align="center">
	<td class="$GLOBALS[bgclass]"><img src="$stylevar[imgdir_statusicon]/$forum[imageprefix]forum_$forum[statusicon].gif" alt="" border="0" id="forum_statusicon_$forum[forumid]" /></td>
	<td class="$GLOBALS[bgclass]" align="$stylevar[left]" id="f$forum[forumid]">
		<div>
			<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]"><strong>$forum[title]</strong></a>
			<if condition="$show['browsers']"><span class="smallfont">(<phrase 1="$forum[browsers]">$vbphrase[x_viewing]</phrase>)</span></if>
		</div>
		<if condition="$show['forumdescription']"><div class="smallfont">$forum[description]</div></if>
		<if condition="$show['forumsubscription']"><div class="smallfont"><strong><a href="subscription.php?$session[sessionurl]do=removesubscription&amp;f=$forum[forumid]" rel="nofollow">$vbphrase[unsubscribe_from_this_forum]</a></strong></div></if>
		<if condition="$show['subforums']"><div class="smallfont" style="margin-top:$stylevar[cellpadding]px"><strong>$vbphrase[subforums]</strong>: $forum[subforums]</div></if>
	</td>
	<td class="$GLOBALS[bgclass]">$forum[lastpostinfo]</td>
	<td class="$GLOBALS[bgclass]">$forum[threadcount]</td>
	<td class="$GLOBALS[bgclass]">$forum[replycount]</td>
	<if condition="$vboptions['showmoderatorcolumn']">
	<td class="$GLOBALS[bgclass]"><div class="smallfont">$forum[moderators]&nbsp;</div></td>
	</if>
</tr>
$childforumbits

5. Hit the [Save] button. We're done! :)