PDA

View Full Version : Alternating Forum Home Rows



Shining Arcanine
Tue 6th Apr '04, 11:51pm
Would someone please tell me how to make the rows on Forum Home alternate colors?

I've searched vBulletin.com, vBulletin.org, vBulletin-templates.com and google and all I have come up with is a template modification for a vBulletin 3.0.0 Beta version. I didn't even find a documentation of the variables that are used throughout the standard templates. :(

Zachery
Wed 7th Apr '04, 1:24am
You want alternating row colors instead of collums?

Shining Arcanine
Wed 7th Apr '04, 9:53am
Yes.

Zachery
Wed 7th Apr '04, 2:03pm
Ill poke around with some code and see what i can get you :)

This is amykhar's code but just updated if you havent modifyed your forumhome_forumbit_level2_post template just replce it with this



<tr align="center">
<td <if condition="$forum['displayorder'] % 2 == 0">class="alt2"<else />class="alt1"</if>><img src="$stylevar[imgdir_statusicon]/forum_$forum[statusicon].gif" alt="" border="0" /></td>
<td <if condition="$forum['displayorder'] % 2 == 0">class="alt2"<else />class="alt1"</if> 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]">$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 <if condition="$forum['displayorder'] % 2 == 0">class="alt2"<else />class="alt1"</if> nowrap="nowrap">$forum[lastpostinfo]</td>
<td <if condition="$forum['displayorder'] % 2 == 0">class="alt2"<else />class="alt1"</if>>$forum[threadcount]</td>
<td <if condition="$forum['displayorder'] % 2 == 0">class="alt2"<else />class="alt1"</if>>$forum[replycount]</td>
<if condition="$vboptions['showmoderatorcolumn']">
<td <if condition="$forum['displayorder'] % 2 == 0">class="alt2"<else />class="alt1"</if>><div class="smallfont">$forum[moderators]&nbsp;</div></td>
</if>
</tr>
$childforumbits

Shining Arcanine
Wed 7th Apr '04, 9:09pm
That made all of the columns the same color. :( Also, wouldn't the conditional go into the table row tag rather than the table data tag like in this example:


<tr align="center" <if condition="$forum['displayorder'] % 2 == 0">class="alt2"<else />class="alt1"</if>>
<td ><img src="$stylevar[imgdir_statusicon]/forum_$forum[statusicon].gif" alt="" border="0" /></td>
<td 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]">$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 nowrap="nowrap">$forum[lastpostinfo]</td>
<td >$forum[threadcount]</td>
<td >$forum[replycount]</td>
<if condition="$vboptions['showmoderatorcolumn']">
<td ><div class="smallfont">$forum[moderators]&nbsp;</div></td>
</if>
</tr>
$childforumbits

Unfortunately, that doesn't work either. :(

Zachery
Wed 7th Apr '04, 9:14pm
No, mine works fine if your forum order is set correcty in the AdminCP > Forums & Modertaors > Forum Manager > they need to in the correct order, ie: 1,2,3,4

Shining Arcanine
Wed 7th Apr '04, 9:53pm
Oh, so that is why, I have mine setup in mutiples of 10. ^_^;;

Edit: It worked! Thanks. It seems my version also worked. :D

amykhar
Thu 8th Apr '04, 4:43pm
I knew that math degree of mine would come in handy some day :D

Zachery
Thu 8th Apr '04, 5:07pm
:) thanks amy :D

HexOnxOnx
Thu 8th Apr '04, 5:39pm
Thanks both of you! I was looking for this for a long time as well. I found something months ago on another site but I could never figure out where to put the code. Got it on my forums now.

HexOnxOnx
Fri 9th Apr '04, 4:26am
Anyone here know how to do this on forum display as well? Thanks!

amykhar
Sat 10th Apr '04, 11:53pm
Anyone here know how to do this on forum display as well? Thanks!
It's a wee bit trickier on forum display for threads because the thread id won't be sequential. I'll take a peek and see what I can do as a template mod.

Amy

HexOnxOnx
Sun 11th Apr '04, 4:50am
Great, thanks!

amykhar
Mon 12th Apr '04, 3:20pm
Unfortunately, I don't see a way to do it as a template mod only. This would require a hack, IMO.

Amy

HexOnxOnx
Mon 12th Apr '04, 6:03pm
Thanks for checking on it anyways Amy!

vbcore
Mon 21st Feb '05, 12:37pm
Sorry to bring back a thread that is approaching 1 year old, but I'm trying to use this on my forum, and I found a little bug.

*Check Attached Screenshot*

Thanks to the person who can help me with this ;)

Moparx
Mon 21st Feb '05, 5:33pm
Sorry to bring back a thread that is approaching 1 year old, but I'm trying to use this on my forum, and I found a little bug.

*Check Attached Screenshot*

Thanks to the person who can help me with this ;)

Zach already did ;)


No, mine works fine if your forum order is set correcty in the AdminCP > Forums & Modertaors > Forum Manager > they need to in the correct order, ie: 1,2,3,4

vbcore
Mon 21st Feb '05, 5:44pm
LOL w0ops