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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30 April 2010 21:20, Daevid Vincent <daevid@xxxxxxxxxx> wrote:
>> -----Original Message-----
>> From: Ashley Sheridan [mailto:ash@xxxxxxxxxxxxxxxxxxxx]
>>
>> 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:rquadling@xxxxxxxxxxxxxx]
>>
>> 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=ZEND002498&r=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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux