Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Content Management System (http://www.go4expert.com/articles/cms/)
-   -   Alternating Colored Rows in vBulletin 4 [No Plugin] (http://www.go4expert.com/articles/alternating-colored-rows-vbulletin-4-t25160/)

shabbir 5Mar2011 13:52

Alternating Colored Rows in vBulletin 4 [No Plugin]
 
How to have alternating colored rows (and not columns) in vBulletin 4. After searching around, I found one by William, Very nice work. His solution is for vBulletin 3 but it can be easily ported to vBulletin 4. As I searched, I saw the problem is talked a lot in forums without any solution for vBulletin 4 and so I decided to put together a solution extending William's work.

1. Edit template forumhome_forumbit_level2_post



Add the following code at the top of the template.

Code:

<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

Code:

<li id="forum{vb:raw forum.forumid}" class="forumbit_post L2">
to
Code:

<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.

Code:

<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.

Code:

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

You can customize the above CSS as per your needs.

I hope this helps fellow vBulletin forum webmasters.

pankaj.sea 6Mar2011 08:08

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Nice tutorial Shabbir!
:)
This was a very common question for webmasters at vBulletin.Org forum! ;) Now it has a solution!!
Thanks!

shabbir 6Mar2011 09:00

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Thanks and if you see someone looking for something now you know what to do?

pankaj.sea 6Mar2011 09:03

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Quote:

Originally Posted by shabbir (Post 80311)
Thanks and if you see someone looking for something now you know what to do?

Sure... ;)

Adam H 30Apr2011 18:56

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
This is a great work around , however i can not seem to get it working on the forumdisplay page . I.e the sub forums above the threadbits, Any ideas ?

shabbir 1May2011 09:59

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
You should be. What are you trying on the forumdisplay? I tried myself and it just works fine

Adam H 1May2011 14:21

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Quote:

Originally Posted by shabbir (Post 82547)
You should be. What are you trying on the forumdisplay? I tried myself and it just works fine

I have just followed your instuctions above , the forumhome is working great however when i click a forum category which has sub forums those subforums are not styled in the same way, is there more code that i have to add to the forumdisplay template ?

shabbir 1May2011 16:27

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Quote:

Originally Posted by Adam H (Post 82551)
I have just followed your instuctions above , the forumhome is working great however when i click a forum category which has sub forums those subforums are not styled in the same way, is there more code that i have to add to the forumdisplay template ?

sub forums will work if they are at level1 but if you have them as level 2 then you may need to edit those templates. Also you can make the same logic even applied to showthread.

Adam H 1May2011 16:40

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Quote:

Originally Posted by shabbir (Post 82552)
sub forums will work if they are at level1 but if you have them as level 2 then you may need to edit those templates. Also you can make the same logic even applied to showthread.

I do not suppose you could tell me how to get the level 2 working and the showthread too ? I seem to be going around in circles when i edit certain templates.

So far i have edited what you have mentioned above :

forumhome_forumbit_level2_post

forumhome_forumbit_level1_post

forumhome_forumbit_level2_nopost

Adam H 1May2011 16:40

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Sorry i meant :

forumhome_forumbit_level1_nopost not forumhome_forumbit_level2_nopost

shabbir 1May2011 18:29

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Quote:

Originally Posted by Adam H (Post 82554)
Sorry i meant :

forumhome_forumbit_level1_nopost not forumhome_forumbit_level2_nopost

What is your vBulletin version. 3 or 4 and I will give you exact steps.

Adam H 1May2011 19:12

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
that would be amazing thank you, Im using vbulletin 4

shabbir 2May2011 07:06

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
For having alternating colors for your threads add the following code at the top of the threadbit template.
Code:

<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
Code:

<li class="threadbit {vb:raw thread.statusstring}
to
Code:

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

Adam H 2May2011 15:36

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Thats great thank you for that , however im still having trouble with the forumdisplay page and the display of the subforums above the threadbit, see image :

imageupload.org/thumb/thumb_32745.png

shabbir 2May2011 17:20

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Can you have a large image because I am not able to understand anything out of that thumb

Adam H 2May2011 17:36

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Sorry please see below,

where i have highlighted in red , is suppose to be a light grey :

tinypic.com/r/20u68tx/7

shabbir 2May2011 20:02

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Your forum has no post and we have not done the changes for forums that don't have posts in it. Try adding one post into that sub forum and then see if it works.

Also I see only one sub forum and for alternating color make them two sub forums

Adam H 2May2011 20:10

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
I have just added posts and added more subforums but its still the same :


tinypic.com/r/vz8twp/7

shabbir 2May2011 20:22

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Can you PM me your forum access and I will be more than happy to help

Adam H 2May2011 22:33

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Unfortunately not, The forum is being worked on a local machine , not on a server which is online. Its all on vb 4.1.3 on the default fresh install of vbulletin. No edits or mods installed.

shabbir 3May2011 10:15

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Quote:

Originally Posted by Adam H (Post 82602)
Unfortunately not, The forum is being worked on a local machine , not on a server which is online. Its all on vb 4.1.3 on the default fresh install of vbulletin. No edits or mods installed.

Probably I cannot help because the same changes done to my fresh vB 4.1.3 worked fine. Also I did the threadbit modification and gave you the instructions. I also don't use vB 4.1.3 online.

Adam H 3May2011 11:29

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Quote:

Originally Posted by shabbir (Post 82608)
Probably I cannot help because the same changes done to my fresh vB 4.1.3 worked fine. Also I did the threadbit modification and gave you the instructions. I also don't use vB 4.1.3 online.


Weird, Ill try it on another live install when i get time, for now i have just added a background colour to the element in the forumdisplay template so its the same colour as one of the alternatives. It will look ok until i work out whats wrong.

Thanks for the help though. Much appreciated.

shabbir 3May2011 12:10

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Quote:

Originally Posted by Adam H (Post 82609)
Weird, Ill try it on another live install when i get time, for now i have just added a background colour to the element in the forumdisplay template so its the same colour as one of the alternatives. It will look ok until i work out whats wrong.

Thanks for the help though. Much appreciated.

Do let me know if you have issues on the live site and I will be more than happy to have a look.

wolepua 21May2013 17:06

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
2 Attachment(s)
Quote:

VB Version: 4.xx

1. Edit template forumhome_forumbit_level2_post

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

Code:

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

Code:

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

hello,i didnt found this code :
Code:

<li id="forum{vb:raw forum.forumid}" class="forumbit_post L2">
original source code :
Code:

<li id="forum{vb:raw forum.forumid}" class="forumbit_post {vb:raw forum.statusicon} L2">
but im still replace the code... and its working only at forumhome.
for forum display.its not working....
and i have a little problem with forumdisplay..
before delete : rgb(255, 255, 255) at Forum Row Background.
attachment number1

after delete : rgb(255, 255, 255) at Forum Row Background. make it transparent.
attachment number 2


how to make it work in forumdisplay?

shabbir 21May2013 17:53

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Did you follow both the steps because it works for me even in the latest vB 4.x

wolepua 21May2013 17:58

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
yes i follow all steps..but only working in forumhome..forum display.its not working..
but ,i didnt found this code :
Code:

<li id="forum{vb:raw forum.forumid}" class="forumbit_post L2">
original source code :
Code:

<li id="forum{vb:raw forum.forumid}" class="forumbit_post {vb:raw forum.statusicon} L2">
im still replace the code :
Code:

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

wolepua 21May2013 18:16

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
here copy from : forumhome_forumbit_level2_post

Code:

<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>
<li id="forum{vb:raw forum.forumid}" class="forumbit_post L2 {vb:raw $rowClass}">
        <div class="forumrow table">


shabbir 21May2013 19:37

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
PM Me your forum URL and I will be more than happy to look into it.

wolepua 21May2013 19:44

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
okay.sent

shabbir 21May2013 19:51

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Quote:

Originally Posted by wolepua (Post 99616)
okay.sent

I don't have your PM.

wolepua 21May2013 19:53

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
hello,
Send a message via email to shabbir
and yahoo messenger..

shabbir 21May2013 20:00

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
I don't use Yahoo. Send me message here in the forums.

shabbir 21May2013 20:15

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
It is working for forum display but for threadbits it is not meant to work but only for forums and not for threads. If you want that refer this post

wolepua 21May2013 20:19

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
okay.but still not change anything

wolepua 21May2013 20:21

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
please check at forum display : Forex Foreign Currencies Exchange Trading Discussion

shabbir 21May2013 20:27

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Quote:

Originally Posted by wolepua (Post 99623)
please check at forum display : Forex Foreign Currencies Exchange Trading Discussion

It is adding the class to the li and you have to be adding the right CSS as well.

wolepua 21May2013 20:31

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
im not familiar with this.can u give me the guide? i mean the code.
thanks

shabbir 21May2013 20:34

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Quote:

Originally Posted by wolepua (Post 99625)
im not familiar with this.can u give me the guide? i mean the code.
thanks

Contact me and I will get that done for you.

wolepua 21May2013 20:36

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
okay.done

shabbir 21May2013 21:20

Re: Alternating Colored Rows in vBulletin 4 [No Plugin]
 
Quote:

Originally Posted by wolepua (Post 99627)
okay.done

I have no email from you.


All times are GMT +5.5. The time now is 03:53.