[Pugged] Switch Troubles

Chris Van Cleve ciapug@ciapug.org
Wed, 26 Mar 2003 08:16:54 -0600


Funny you should provide that snippet, Tim. I found something similar at a 
script site and modified it for my own use:

function row_color($c){ 
    if ( ($c % 2) == 0 ) {
        return '#e1e1e1'; 
    } else { 
        return '#f5f5f5'; 
    } 
} 

-- 
Chris 'Vanish' Van Cleve
CEO, President, Founder
DreamScape Visionery


Quoting Tim Perdue <tim@perdue.net>:

> David Champion wrote:
> > Simpler (pseudo) code:
> > 
> > $x = 0;
> > for ... {
> >   $x++
> >   if ($x == 1) {
> >     $bgcolor = "#aaaaaa";
> >     $x = 0;
> >   } else {
> >     $bgcolor = $defcolor;
> >   }
> >   //...yada yada yada
> >   $rs->MoveNext();
> > }
> 
>      function boxGetAltRowStyle($i) {
>          if ($i % 2 == 0) {
>              return 'style="background-color:white"';
>          } else {
>              return 'style="background-color:' . $this->COLOR_LTBACK1 . '"';
>          }
>      }
> 
> 
> That works too - even numbers are a certain color - odd numbers are the 
> other color.
> 
> 
> _______________________________________________
> Ciapug mailing list
> Ciapug@ciapug.org
> http://cialug.org/mailman/listinfo/ciapug
>