PDA

View Full Version : Alternating Colored Rows in vBulletin 4


bskr84
01-22-2011, 06:33 AM
125935

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

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

4.Edit CSS

Now add the following CSS in the additional.css template.
.altodd {background-color:#eee;}
.alteven {background-color:#fff;}

You can customize the above CSS as per your needs.

--------------- Added 1309152509 at 1309152509 ---------------

For having alternating colors for your threads add the following code at the top of the threadbit 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>

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}

Edit CSS

Now add the following CSS in the additional.css template.
.altodd {background-color:#eee;}
.alteven {background-color:#fff;}
You can customize the above CSS as per your needs.

Spyike
01-24-2011, 02:49 AM
If you are referring to the text that is displayed when hovering over a thread open the Forum Display Templates in Style Manager, then navigate to FORUMDISPLAY. Double click it and search for the following:
<vb:if condition="$foruminfo['description']"><p class="description">{vb:raw foruminfo.description}</p></vb:if>

Change "{vb:raw foruminfo.description}" to what you want the text to say (will be universal for all threads).

If you are referring to the colors.. that is simply a style issue.

I do not see anything different on the image above from default vBulletin other than the two things I listed above

Frost5
02-06-2011, 03:25 AM
This is the closest thing I can think of...

Style Vars -> Forums ->

Forumhome_background
Forumhome_firstentry_background

Just play around with those 2, should be able to get what you want.

napy8gen
06-27-2011, 03:05 AM
<a href="http://www.go4expert.com/forums/showthread.php?t=25160" target="_blank">http://www.go4expert.com/forums/showthread.php?t=25160</a>

for threadbit like you wanted. you can see how to do it at the same thread page no2.

napy8gen
06-27-2011, 03:30 AM
yes thats the hack. intermediate users only :-)