Alternate Colours for vbulletin 4 forum rows ( forum home ) and ( forumdisplay )

Other forum platforms like IPB have some very nice styles which allow alternate colour forum rows which allows things to look very smooth indeed. After looking around for a while for some pre-made code i would like to thank the source ( at the bottom of this article ).

1. Edit template forumhome_forumbit_level2_post

Add the following code at the top of the template.

<vb:if condition=”$altrow =& $GLOBALS['altrow']“></vb:if>
<vb:if condition=”!isset($altrow)”>
<vb:if condition=”$altrow = 0″></vb:if>
</vb:if>
<vb:if condition=”++$altrow % 2 == 0″>
<vb:if condition=”$rowClass = ‘alteven’”></vb:if>
<vb:else />
<vb:if condition=”$rowClass = ‘altodd’”></vb:if>
</vb:if>

Credit for the above code goes to William and forumthemes.

Now change the first line (first line before inserting the above code) from

<li id=”forum{vb:raw forum.forumid}” class=”forumbit_post L2″>

to

<li id=”forum{vb:raw forum.forumid}” class=”forumbit_post L2 {vb:raw $rowClass}”>

2. Edit forumhome_forumbit_level1_post / _nopost

Add the following at the top of forumhome_forumbit_level1_post and forumhome_forumbit_level1_nopost template.

<vb:if condition=”$altrow =& $GLOBALS['altrow']“></vb:if>
<vb:if condition=”$altrow = 0″></vb:if>

3. Edit Stylevars


!Important :
Edit forumrow_firstentry_background and forumrow_background stylevars and make it transparent by deleting Background Color and Background Image.

To also get this working on the forumdiplay pages you will need to do the following :

Goto threadbit template , at this to the very top :

<vb:if condition=”$altrow =& $GLOBALS['altrow']“></vb:if>
<vb:if condition=”!isset($altrow)”>
<vb:if condition=”$altrow = 0″></vb:if>
</vb:if>
<vb:if condition=”++$altrow % 2 == 0″>
<vb:if condition=”$rowClass = ‘alteven’”></vb:if>
<vb:else />
<vb:if condition=”$rowClass = ‘altodd’”></vb:if>
</vb:if>

And then edit the first line of the code as follows.
Change

<li class=”threadbit {vb:raw thread.statusstring}

To :

<li class=”threadbit {vb:raw $rowClass} {vb:raw thread.statusstring}

4.Edit CSS

Add the following to the additional.css :

.altodd {background-color:#eee;}
.alteven {background-color:#fff;}

You can change the colour codes to match the alternating colours as desired.

Source : http://www.go4expert.com/forums/showthread.php?t=25160

Tags:

Comments are closed.