Re: [PHP] Two color rows in table inside while iteration -- just say no to mod

2010-05-05 Thread Michiel Sikma
On 3 May 2010 08:25, Jochen Schultz jschu...@sportimport.de wrote:

  [snip]

  And unless we are adding a multiple seconds to the load time is anyone
 going to notice a difference of 1 second?


 yes



It's really not that big a deal.
http://pastie.org/947121

Personally, I think using modulus is as nice a solution as flipping a bit.
Maybe more elegant since it's extendable to more than 2 states if required.

Michiel


Re: [PHP] Two color rows in table inside while iteration -- just say no to mod

2010-05-03 Thread Jochen Schultz

 [snip]
And unless we are adding a multiple seconds to the load time is anyone 
going to notice a difference of 1 second? 


yes


regards
Jochen

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Two color rows in table inside while iteration -- just say no to mod

2010-05-01 Thread Richard Quadling
On 30 April 2010 21:20, Daevid Vincent dae...@daevid.com wrote:
 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]

 Modulus is the most elegant solution I reckon. Imagine if you only
 needed to highlight every 3rd row, or 4th? Easy to change the modulus
 for it, not so easy to re-work a binary switch.

 -Original Message-
 From: Richard Quadling [mailto:rquadl...@googlemail.com]

 The modulus is a good option when there are more than 2 states.

 Say a 5 row fade ...

 $a=0;
 while ($row=mysql_fetch_...){
 echo tr class=??\alternate-row-.(1 + (++$a%5)).\...
 }

 giving alternate-row-1, alternate-row-2, alternate-row-3,
 alternate-row-4 and alternate-row-5

 Okay, how many tables do you EVER see with more than TWO colors? Come on
 now.

 Show me some URL's to REAL sites (not some contrived examples) that use
 multiple row colors or fades in a rotating fashion. Not talking about a
 highlight roll-over, nor am I talking about highlighting rows of certain
 criteria in different colors, as both of those are not the problem for this
 solution. I'm talking about a straight up table that cycles each row more
 than 2 colors.

 99% of your tables are 2 colors, and flipping a bit (i.e. Boolean) is WAY
 faster to compute than modulus and also easier to understand.

 http://www.youtube.com/watch?v=pXhKzY0BKwY  ;-) (I say that out of love!)

 d


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



Ha. OK, I actually do use a bit toggle for assigning a CSS class to
the alternative rows. But I did once use % where the table represented
a top10 list.



-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Two color rows in table inside while iteration -- just say no to mod

2010-04-30 Thread Daevid Vincent
 -Original Message-
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
 
 Modulus is the most elegant solution I reckon. Imagine if you only
 needed to highlight every 3rd row, or 4th? Easy to change the modulus
 for it, not so easy to re-work a binary switch. 

 -Original Message-
 From: Richard Quadling [mailto:rquadl...@googlemail.com] 
 
 The modulus is a good option when there are more than 2 states.
 
 Say a 5 row fade ...
 
 $a=0;
 while ($row=mysql_fetch_...){
 echo tr class=??\alternate-row-.(1 + (++$a%5)).\...
 }
 
 giving alternate-row-1, alternate-row-2, alternate-row-3,
 alternate-row-4 and alternate-row-5

Okay, how many tables do you EVER see with more than TWO colors? Come on
now.

Show me some URL's to REAL sites (not some contrived examples) that use
multiple row colors or fades in a rotating fashion. Not talking about a
highlight roll-over, nor am I talking about highlighting rows of certain
criteria in different colors, as both of those are not the problem for this
solution. I'm talking about a straight up table that cycles each row more
than 2 colors.

99% of your tables are 2 colors, and flipping a bit (i.e. Boolean) is WAY
faster to compute than modulus and also easier to understand.

http://www.youtube.com/watch?v=pXhKzY0BKwY  ;-) (I say that out of love!)

d


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Two color rows in table inside while iteration -- just say no to mod

2010-04-30 Thread Jason Pruim


On Apr 30, 2010, at 4:20 PM, Daevid Vincent wrote:


-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk]

Modulus is the most elegant solution I reckon. Imagine if you only
needed to highlight every 3rd row, or 4th? Easy to change the modulus
for it, not so easy to re-work a binary switch.

-Original Message-
From: Richard Quadling [mailto:rquadl...@googlemail.com]

The modulus is a good option when there are more than 2 states.

Say a 5 row fade ...

$a=0;
while ($row=mysql_fetch_...){
echo tr class=??\alternate-row-.(1 + (++$a%5)).\...
}

giving alternate-row-1, alternate-row-2, alternate-row-3,
alternate-row-4 and alternate-row-5


Okay, how many tables do you EVER see with more than TWO colors?  
Come on

now.

Show me some URL's to REAL sites (not some contrived examples) that  
use
multiple row colors or fades in a rotating fashion. Not talking  
about a
highlight roll-over, nor am I talking about highlighting rows of  
certain
criteria in different colors, as both of those are not the problem  
for this
solution. I'm talking about a straight up table that cycles each row  
more

than 2 colors.

99% of your tables are 2 colors, and flipping a bit (i.e. Boolean)  
is WAY

faster to compute than modulus and also easier to understand.

http://www.youtube.com/watch?v=pXhKzY0BKwY  ;-) (I say that out of  
love!)



A bit of a contrived example... BUT... I could envision having  
multiple (more then 2) colors on a blog with comments...


Maybe it's a patriotic blog and they want the comments to cycle  
between red, white  blue... (Or your countries colors) And yes I know  
that you could assume white is a default... But I know some people who  
have the default color of their web browser set to bright pink to  
point out where rules aren't specifically assigned :)


And unless we are adding a multiple seconds to the load time is anyone  
going to notice a difference of 1 second? Or am I wrong?


Also... I'm not trying to start a fight... Just trying to understand  
the different possibilities and the impact :) Hoping to write the next  
facebook eventually But aren't we all? ;)




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php