Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-15-2005, 11:59 AM
SS9267547's Avatar
SS9267547 SS9267547 is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 390
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Alternating Row Color

Morning all, I have a quick question about alternating row colors. How would I make this work on any page in vbulletin? I have this working in forumdisplay, showthread, etc but I can't get it to work for example under memberlist.php or online.php. All it does is show one color but doesn't alternate. This is what I've been using.

Example:
PHP Code:
<if condition="exec_switch_bg()"></if>
<
tr>
<
td class="$bgclasswidth="100" height="18">&nbspText Here</td>
</
tr
Any help in the mater would be great, thanks.
Reply With Quote
  #2  
Old 02-15-2005, 02:33 PM
deathemperor's Avatar
deathemperor deathemperor is offline
 
Join Date: Jul 2003
Location: HOL
Posts: 1,270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you need to modify no templates, just go to ACP --> Styles & Templates -> Style Manager -> Edit Main CSS --> now you just change the value in "Background" for Alt1 and Alt2 to the same then it would show the same color for row.
Reply With Quote
  #3  
Old 02-15-2005, 10:35 PM
SS9267547's Avatar
SS9267547 SS9267547 is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 390
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the reply but I don't think thats what I'm looking for. What I would like is to keep Alt1 and Alt2 different colors and have the rows alternate the colors so one if one row is white the next would be black and so forth.
Reply With Quote
  #4  
Old 02-15-2005, 10:39 PM
trafix's Avatar
trafix trafix is offline
 
Join Date: Dec 2002
Location: Australia
Posts: 1,021
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
 
                
if (($counter++ % 2) != 0
                {
                    
$backcolor "class=\"alt1\"";
                } 
                else 
                {
                    
$backcolor "class=\"alt2\"";
                } 
Reply With Quote
  #5  
Old 02-15-2005, 10:47 PM
SS9267547's Avatar
SS9267547 SS9267547 is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 390
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Now I would insert the code into memberlist.php or whatever the file I need and not in the templates?
Reply With Quote
  #6  
Old 02-15-2005, 10:51 PM
trafix's Avatar
trafix trafix is offline
 
Join Date: Dec 2002
Location: Australia
Posts: 1,021
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

correct

and your template bit would look something like
HTML Code:
<tr>
		<td align="center" $backcolor>
	whatever
	</td>
	
</tr>
Reply With Quote
  #7  
Old 02-15-2005, 11:07 PM
SS9267547's Avatar
SS9267547 SS9267547 is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 390
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah what a pain. Still can't get it to work, seems to still display one color on all the rows. Dosn't matter what code I use, displays one or the other hehe. :speechless:
Reply With Quote
  #8  
Old 02-16-2005, 12:06 AM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here is what I used (the entire while statement)
PHP Code:
while($app=$DB_site->fetch_array($getmiscapps))
    {
      if(
$col  %2  ==  0)
       {
         
$color='alt1';
       }
      else
       {
         
$color='alt2';
       }
      ... 
CENSORED!
      
$col++;
    } 
Looks like you are just missing the $name++.
Reply With Quote
  #9  
Old 02-16-2005, 12:10 AM
trafix's Avatar
trafix trafix is offline
 
Join Date: Dec 2002
Location: Australia
Posts: 1,021
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TheSpecialist
Here is what I used (the entire while statement)
PHP Code:
while($app=$DB_site->fetch_array($getmiscapps))
    {
      if(
$col  %2  ==  0)
       {
         
$color='alt1';
       }
      else
       {
         
$color='alt2';
       }
      ... 
CENSORED!
      
$col++;
    } 
Looks like you are just missing the $name++.
thats the long way around .... i dont use it in a while loop ... and im not missing the $name++

but your code should still work
Reply With Quote
  #10  
Old 10-29-2006, 10:27 AM
imported_infitech's Avatar
imported_infitech imported_infitech is offline
 
Join Date: Apr 2004
Location: Queens, NY
Posts: 247
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by trafix
PHP Code:
 
                
if (($counter++ % 2) != 0
                {
                    
$backcolor "class=\"alt1\"";
                } 
                else 
                {
                    
$backcolor "class=\"alt2\"";
                } 
i tried to do this for every alternating tcat in my vbadvanced cmps by putting it in my forums/global.php and editing adv_porta;_module_shell here
Code:
$mods[formcode]
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
	<thead>
		<tr>
			<td colspan="$mods[colspan]" $backcolor>
and it didnt work.... any ideas? im not a coder.
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 04:15 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04475 seconds
  • Memory Usage 2,272KB
  • Queries Executed 11 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_html
  • (5)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete