vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Alternating Row Color (https://vborg.vbsupport.ru/showthread.php?t=76360)

SS9267547 02-15-2005 11:59 AM

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.

deathemperor 02-15-2005 02:33 PM

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.

SS9267547 02-15-2005 10:35 PM

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.

trafix 02-15-2005 10:39 PM

PHP Code:

 
                
if (($counter++ % 2) != 0
                {
                    
$backcolor "class=\"alt1\"";
                } 
                else 
                {
                    
$backcolor "class=\"alt2\"";
                } 


SS9267547 02-15-2005 10:47 PM

Now I would insert the code into memberlist.php or whatever the file I need and not in the templates?

trafix 02-15-2005 10:51 PM

correct

and your template bit would look something like
HTML Code:

<tr>
                <td align="center" $backcolor>
        whatever
        </td>
       
</tr>


SS9267547 02-15-2005 11:07 PM

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:

Adrian Schneider 02-16-2005 12:06 AM

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++. :)

trafix 02-16-2005 12:10 AM

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

imported_infitech 10-29-2006 10:27 AM

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.


All times are GMT. The time now is 11:38 AM.

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.01205 seconds
  • Memory Usage 1,747KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_html_printable
  • (5)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete