Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Template Modifications
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Alternating Row Color for Forums / Search Results / Thread Listings Details »»
Alternating Row Color for Forums / Search Results / Thread Listings
Version: .3, by nevetS nevetS is offline
Developer Last Online: Oct 2008 Show Printable Version Email this Page

Version: 3.6.0 Rating:
Released: 09-02-2006 Last Update: 09-06-2006 Installs: 49
Uses Plugins Template Edits
 
No support by the author.

What this plugin/modification does:
In the default vBulletin implementation, the colors alternate from left to right - from table cell to table cell. This plugin/modification changes it so that each row changes colors instead.

For a visual, we're talking about changing this:
---------------------------
| red | blue | red | blue |
---------------------------
| red | blue | red | blue |
---------------------------
| red | blue | red | blue |
---------------------------
To this:
-----------------------------
| red |
red | red | red |
---------------------------
--
| blue | blue | blue | blue |
-----------------------------
| red | red | red | red |
-----------------------------


Currently, this plugin enables changing row colors in
  • Forum Listing in the Forum Home page (screenie attached)
  • Sub Forum Listing (screenie attached)
  • Thread Listing (screenie attached)
  • Search Results Page (screenie attached)
  • PM Listing
  • Member Listings
How it works:
The way the colors are currently assigned is via CSS classes. The template changes remove the class definitions from the table cells, and add class definitions to the displayed rows. The CSS Classes used are the "Alt1" and "Alt2" classes - defined in the Admin Control Panel under Style Manager, (style), Main CSS, "First Alternating Color" and "Second Alternating Color".

The Product is named "Alternating Row Color for ForumBits".
Attached to the product are Four plugins:
Alternating Row Color for ForumBits Function - this defines a brief function enabled at the "global_start" hook location.
Code:
function forumRowClass($myrownum){
 return $result = ($myrownum %2 == 0)? ('alt1') : ('alt2');
}
This function is called from other plugins to define whether or not they should be presented with the "alt1" CSS Class, or the "alt2" CSS Class.
The other three plugins -Alternating Threadbit background, Alternating Row Color for ForumBits, Alternating Row Color Search Threadbit - are copy/paste functionality enabled in three separate locations:
Code:
$myrownum++;
$rowClass = forumRowClass($myrownum);
Basically, as vbulletin iterates through creating the rows to display, it calls the function to find out which CSS class to use.
Making minor changes:
If you would rather the colors be switched, simply swap 'alt1' and 'alt2' in the "Alternating Row Color for ForumBits Function" plugin.

What's Involved?
1 Product Installation
4 Plugins (installed all at once, via the product)
47 Changes to 5 Templates

Credit To
VBSeo.com for giving me the idea.


Updates
9/6/2006
got rid of funky quotes in updated_memberlist_reslutsbit.tmpl.php

9/5/2006
Version .3
Updated Mod Description, Install Instructions, downloadable files
Added functionality for Memberlist Alternating Colors
Added functionality for PM Listing Alternating Row Colors
Added new templates - pm_messagelistbit and memberlist_resultsbit

9/3/2006

Updated Mod Description
Installation Instructions
Added additional Screenshots
Uploaded pre-modified out-of-the-box templates
Re-uploaded zip file with appropriate paths
Mod Title Update

9/2/2006
Version .2 - Added plugin to alternate row colors in search results, which also implies the ability to alternate row colors in thread listings.

Installation:
Downloads are on the right. The zip file contains the xml plugin file as well as pre-modified template updates. Only use the premodified templates if the following statements are all true:
1) You are running vBulletin 3.6.0
2) You have not modified the templates to be updated.


There are now 5 templates I have identified that need updating. These templates are:
  • threadbit
  • forumhome_forumbit_level1_post
  • forumhome_forumbit_level2_post
  • memberlist_resultsbit
  • pm_messagelistbit
Step 1) Go into your AdminCP, Click Add/Import Product, Upload the product-alternating-forum-rows.xml file.

For the remaining steps, I'm going to go through three iterations of instructions: "The Really Easy Way", "The Easy Way", and "The Hard Way"
Just Pick ONE set of instructions to follow!
Instructions for "The Really Easy Way":
  1. If you didn't follow the instructions above, upload the product-alternating-forum-rows.xml file into your Product Manager
  2. Replace your unmodified threadbit template with updated_threadbit.tmpl.php
  3. Replace your unmodified 3.6.0 forumhome_forumbit_level1_post template with updated_forumhome_forumbit_level1_post.tmpl.php
  4. Replace your unmodified 3.6.0 forumhome_forumbit_level2_post template with updated_forumhome_forumbit_level2_post.tmpl.php
  5. Replace your unmodified 3.6.0 memberlist_resultsbit template with updated_ memberlist_resultsbit.tmpl.php
  6. Replace your unmodified 3.6.0 pm_messagelistbit template with updated_ pm_messagelistbit.tmpl.php
At this point, you are done. No need to read further or execute anymore steps. Take a look at your forum, if it doesn't look right come back and ask for help.
============================

Installation Instructions for "The Easy Way"
If you didn't follow the instructions above, upload the product-alternating-forum-rows.xml file into your Product Manager

threadbit template updates
1) On the very first line, change
Code:
<tr>
to
Code:
<tr class="$rowClass">
2) search and remove:
2) Find all ' class="alt1"' and remove
3) Find all ' class="alt2"' and remove

forumhome_forumbit_level1_post updates
1) On the second line, change
Code:
<tr align="center">
to
Code:
<tr class="$rowClass" align="center">
2) search and remove:
2) Find all ' class="alt1"' and remove
3) Find all ' class="alt2"' and remove
4) Find all ' class="alt1Active"' and remove

forumhome_forumbit_level2_post
1) On the very first line, change
Code:
<tr>
to
Code:
<tr class="$rowClass">
2) search and remove:
2) Find all ' class="alt1"' and remove
3) Find all ' class="alt2"' and remove
4) Find all ' class="alt1Active"' and remove


pm_messagelistbit
1) On the very first line, change
Code:
<tr>
to
Code:
<tr class="$rowClass">
2) search and remove:
2) Find all ' class="alt1"' and remove
3) Find all ' class="alt2"' and remove
4) Find all ' class="alt1Active"' and remove

memberlist_resultsbit
1) change
Code:
<tr align="center">
to
Code:
<tr class="$rowClass" align="center">
2) search and remove:
2) Find all ' AND exec_switch_bg()"' and remove
3) Find all ' class="$bgclass"' and remove
4) Find all ' class="alt1Active"' and remove
5) Find all ' class="alt2"' and remove

At this point, you are done. No need to read further or execute anymore steps. Take a look at your forum, if it doesn't look right come back and ask for help.
============================

Installation Instructions for "The Hard Way"
(see the attached zip file. It was making this thread too difficult to read)

Supporters / CoAuthors

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #42  
Old 09-10-2006, 09:18 AM
aceofspades's Avatar
aceofspades aceofspades is offline
 
Join Date: Apr 2006
Posts: 306
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks nevetS, you were right. Fixed and working perfectly, thank you
Reply With Quote
  #43  
Old 09-12-2006, 10:55 AM
Ascor's Avatar
Ascor Ascor is offline
 
Join Date: Jul 2006
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just installed the update, all working nice, thank's again nevest
Reply With Quote
  #44  
Old 11-27-2006, 01:57 AM
Smoothie Smoothie is offline
 
Join Date: Oct 2001
Location: New York
Posts: 1,834
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have a quick question. I added a template and a modification that shows another row on forum home, but the alt1 and alt2 in the new template isn't looking quite right. Is it possible to get this new template to work with this mod?
Reply With Quote
  #45  
Old 01-01-2007, 11:17 PM
PayBas PayBas is offline
 
Join Date: Jun 2006
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I used this product/plugin but now I found this other way that doesnt require plugins, and can be modified super easy for each template it is used in.

http://www.vbulletin-styles.com/showthread.php?t=23841

its basically does the exact same thing
Reply With Quote
  #46  
Old 01-18-2007, 04:00 AM
PennylessZ28 PennylessZ28 is offline
 
Join Date: Mar 2002
Location: North America
Posts: 737
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by PayBas View Post
I used this product/plugin but now I found this other way that doesnt require plugins, and can be modified super easy for each template it is used in.

http://www.vbulletin-styles.com/showthread.php?t=23841

its basically does the exact same thing
that link is invalid.
Reply With Quote
  #47  
Old 01-18-2007, 04:15 AM
PennylessZ28 PennylessZ28 is offline
 
Join Date: Mar 2002
Location: North America
Posts: 737
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh BTW: If you wanted to make your stickies stand out after doing this, try this little trick:

Code:
<if condition="$thread['sticky'] == 1">
<tr class="sticky">
<else />
<tr class="$rowClass">
</if>
Code:
.sticky {background-color: pink; 	color: #000000}
Reply With Quote
  #48  
Old 02-21-2007, 01:42 PM
stek2006 stek2006 is offline
 
Join Date: Feb 2007
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks so much for this mod - it's exactly what I needed.

I've also modified my templates to use a simpler table row based display on showthread.php - which works fine, but I'd like to use the alternating background colours.

I tried just creating a copy of the 'Alternating Row Color Search Threadbit' plug in and set this to start with the correct postbit hook... changed the tr class to $rowClass but each row seems to show the .alt2 class regardless.

Any suggestions?
Reply With Quote
  #49  
Old 03-13-2007, 11:53 AM
maxicep maxicep is offline
 
Join Date: Oct 2006
Location: California
Posts: 288
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice hack, installed.
Reply With Quote
  #50  
Old 03-19-2007, 05:16 PM
magnus's Avatar
magnus magnus is offline
 
Join Date: Apr 2002
Location: Miami, FL
Posts: 1,107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was using this modification up until I read PayBas's post. To accomplish this without the need for plugins or extra functions simply uninstall the product (leaving the template changes in place) and re-edit the templates listed in the instructions, adding the following to the top of each template:

HTML Code:
<if condition="$altrow =& $GLOBALS['altrow']"></if>
<if condition="!isset($altrow)">
	<if condition="$altrow = 0"></if>
</if>
<if condition="++$altrow % 2 == 0">
	<if condition="$rowClass = 'alt1'"></if>
<else />
	<if condition="$rowClass = 'alt2'"></if>
</if>

That's it.
Reply With Quote
  #51  
Old 03-21-2007, 12:02 PM
maxicep maxicep is offline
 
Join Date: Oct 2006
Location: California
Posts: 288
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by magnus View Post
I was using this modification up until I read PayBas's post. To accomplish this without the need for plugins or extra functions simply uninstall the product (leaving the template changes in place) and re-edit the templates listed in the instructions, adding the following to the top of each template:

HTML Code:
<if condition="$altrow =& $GLOBALS['altrow']"></if>
<if condition="!isset($altrow)">
	<if condition="$altrow = 0"></if>
</if>
<if condition="++$altrow % 2 == 0">
	<if condition="$rowClass = 'alt1'"></if>
<else />
	<if condition="$rowClass = 'alt2'"></if>
</if>

That's it.
this hack work with without a product, with your way?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:10 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05166 seconds
  • Memory Usage 2,344KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (14)bbcode_code
  • (2)bbcode_html
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete