Re: [PHP] Alternate Colors in Rows ($r=!$r)

2007-10-05 Thread Nathan Nobbe
On 10/5/07, Jay Blanchard <[EMAIL PROTECTED]> wrote: > > > It looks like PHP has an "unintentional feature". Doing this; if($r = > !$r) should always return TRUE because it is an assignment. I don't know > if I would rely on this. > > its not an unintentional operation; its the order of operations

RE: [PHP] Alternate Colors in Rows ($r=!$r)

2007-10-05 Thread Robert Cummings
On Fri, 2007-10-05 at 14:17 -0500, Jay Blanchard wrote: > [snip] > if($r = !$r) > [/snip] > > And I hit send before I finished my thought process oh my goodness isn't > it five o'clock yet and why do all of these people keep coming by my > office distracting me from getting something useful done l

Re: [PHP] Alternate Colors in Rows ($r=!$r)

2007-10-05 Thread Jeff Cohan
Nathan Nobbe wrote: > personally, i wont argue w/ the compact nature of the > statement; its nice. I agree. Very elegant. Thanks for the clarifications, folks. > its mysterious statements like this that make code fragile, > imho. i prefer the modulus approach. I would have agreed before readi

RE: [PHP] Alternate Colors in Rows ($r=!$r)

2007-10-05 Thread Daevid Vincent
D.Vin http://daevid.com > -Original Message- > From: Jay Blanchard [mailto:[EMAIL PROTECTED] > Sent: Friday, October 05, 2007 11:39 AM > To: Robert Cummings; Jeff Cohan > Cc: php-general@lists.php.net > Subject: RE: [PHP] Alternate Colors in Rows ($r=!$r) > > [snip

RE: [PHP] Alternate Colors in Rows ($r=!$r)

2007-10-05 Thread Jay Blanchard
[snip] > if($r = !$r) > > it is a conditional test. > > ? foo : bar; > > ...is the ternary operation. Just wanted to clean up the usage there. Did I miss something? The code I saw was the following: > And that is definitely using the ternary operator. [/snip] No, you didn't miss anyt

RE: [PHP] Alternate Colors in Rows ($r=!$r)

2007-10-05 Thread Jay Blanchard
[snip] if($r = !$r) [/snip] And I hit send before I finished my thought process oh my goodness isn't it five o'clock yet and why do all of these people keep coming by my office distracting me from getting something useful done like replying the PHP list and why doesn't someone bring me a beer? if

RE: [PHP] Alternate Colors in Rows ($r=!$r)

2007-10-05 Thread Robert Cummings
On Fri, 2007-10-05 at 14:04 -0500, Jay Blanchard wrote: > [snip] > The value of the expression is the value assigned. Since the ! operator > will always return a boolean then the assigned value is going to be a > boolean. So $r will always contain a boolean for the purposes of the > ternary operati

RE: [PHP] Alternate Colors in Rows ($r=!$r)

2007-10-05 Thread Jay Blanchard
[snip] The value of the expression is the value assigned. Since the ! operator will always return a boolean then the assigned value is going to be a boolean. So $r will always contain a boolean for the purposes of the ternary operation. And it also work if the statement is not ternary [/snip] And

Re: [PHP] Alternate Colors in Rows ($r=!$r)

2007-10-05 Thread Robert Cummings
On Fri, 2007-10-05 at 14:49 -0400, Nathan Nobbe wrote: > On 10/5/07, Jay Blanchard <[EMAIL PROTECTED]> wrote: > > It looks like PHP has an "unintentional feature". Doing this; > if($r = > !$r) should always return TRUE because it is an assignment. I > don't

RE: [PHP] Alternate Colors in Rows ($r=!$r)

2007-10-05 Thread Jay Blanchard
[snip] The value of the expression is the value assigned. Since the ! operator will always return a boolean then the assigned value is going to be a boolean. So $r will always contain a boolean for the purposes of the ternary operation. [/snip] And it also work if the statement is not ternary --

RE: [PHP] Alternate Colors in Rows ($r=!$r)

2007-10-05 Thread Robert Cummings
On Fri, 2007-10-05 at 13:46 -0500, Jay Blanchard wrote: > [snip] > > > > But why does the ($r=!$r) ternary condition work?. (I understand > > that it DOES but not WHY.) > [/snip] > > Check this out - > http://us3.php.net/manual/en/language.operators.assignment.php > > It says the value of the as

RE: [PHP] Alternate Colors in Rows ($r=!$r)

2007-10-05 Thread Jay Blanchard
[snip] > > But why does the ($r=!$r) ternary condition work?. (I understand > that it DOES but not WHY.) [/snip] Check this out - http://us3.php.net/manual/en/language.operators.assignment.php It says the value of the assignment is the value assigned, so maybe assignments to anything other than

Re: [PHP] Alternate Colors in Rows ($r=!$r)

2007-10-05 Thread Jim Lucas
Jay Blanchard wrote: We just did that proof in the office as well. With a little echoing you will see that when $r is TRUE it is set to 1, when it is false it is set to NULL. But it still should not work logically because you are performing an assignment in the IF (it doesn't have to be ternary

RE: [PHP] Alternate Colors in Rows ($r=!$r)

2007-10-05 Thread Jay Blanchard
[snip] > > But why does the ($r=!$r) ternary condition work?. (I understand > that it DOES but not WHY.) Because he's rotating between boolean values. $r = true; $r = !$r;// Now $r is false; $r = !$r;// Now $r is true; $r = !$r;// Now $r is false; $r = !$r;/

Re: [PHP] Alternate Colors in Rows ($r=!$r)

2007-10-05 Thread Robert Cummings
On Fri, 2007-10-05 at 14:00 -0500, Jeff Cohan wrote: > Daevid Vincent wrote: > > > > > I love the simplicity, and very cool. > > But why does the ($r=!$r) ternary condition work?. (I understand > that it DOES but not WHY.) Because he's rotating between boolean values. $r = true; $r =

Re: [PHP] Alternate Colors in Rows ($r=!$r)

2007-10-05 Thread Jeff Cohan
Daevid Vincent wrote: > > I love the simplicity, and very cool. But why does the ($r=!$r) ternary condition work?. (I understand that it DOES but not WHY.) TIA, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Alternate Colors in Rows

2007-10-04 Thread Daevid Vincent
ple... Anyways, this is a dead horse. D.Vin http://daevid.com > -Original Message- > From: Robert Cummings [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 04, 2007 1:04 PM > To: Daevid Vincent > Cc: 'PHP eMail List' > Subject: RE: [PHP] Alternate Colors in R

RE: [PHP] Alternate Colors in Rows

2007-10-04 Thread Robert Cummings
On Thu, 2007-10-04 at 22:14 +0200, WeberSites LTD wrote: > You can choose to view source with IE in other editors too. > I use Editplus with IE7. That wasn't the reason I pimped Opera though. I would NEVER use IEX as my development browser. I do all my HTML for Opera, then I check it in Firefox,

RE: [PHP] Alternate Colors in Rows

2007-10-04 Thread WeberSites LTD
] Alternate Colors in Rows On Wed, 2007-10-03 at 22:12 -0400, Nathan Nobbe wrote: > On 10/3/07, Robert Cummings <[EMAIL PROTECTED]> wrote: > Hopefully you're using a decent browser (almost > anything other than IE -- I recommend Opera :) > > opera is the best f

RE: [PHP] Alternate Colors in Rows

2007-10-04 Thread Robert Cummings
On Thu, 2007-10-04 at 12:28 -0700, Daevid Vincent wrote: > This was a joke right? You don't seriously do this in r.l. just to alternate > row colors I hope? This certainly was NOT a joke. I do use CSS classes. As for using a PHP class to implement the cycle-- No, I don't do that IRL. As I said in

RE: [PHP] Alternate Colors in Rows

2007-10-04 Thread Daevid Vincent
> Subject: Re: [PHP] Alternate Colors in Rows > > In the following example I show a simple OOP example (because I felt > like it) and illustrate why using CSS classes is the most powerful way > to do row style cycling. Hopefully you're using a decent > browser (almost > anyt

Re: [PHP] Alternate Colors in Rows

2007-10-04 Thread tedd
At 1:44 PM -0500 10/3/07, Steve Marquez wrote: Greetings, I am attempting to alternate the colors of the container DIV. Anyone know how to do this? Hi Steve: Easy and simple. First, keep presentation separate from data. In other words, use css to define a css-class, like so: .row0

Re: [PHP] Alternate Colors in Rows

2007-10-04 Thread Robert Cummings
On Wed, 2007-10-03 at 22:12 -0400, Nathan Nobbe wrote: > On 10/3/07, Robert Cummings <[EMAIL PROTECTED]> wrote: > Hopefully you're using a decent browser (almost > anything other than IE -- I recommend Opera :) > > opera is the best for straight browsing. ive found i could have 40

Re: [PHP] Alternate Colors in Rows

2007-10-03 Thread Nathan Nobbe
On 10/3/07, Robert Cummings <[EMAIL PROTECTED]> wrote: > > Hopefully you're using a decent browser (almost > anything other than IE -- I recommend Opera :) > opera is the best for straight browsing. ive found i could have 40 to 50 tabs open with no noticeable perforrmace hit. firefox bogs badly

Re: [PHP] Alternate Colors in Rows

2007-10-03 Thread Robert Cummings
In the following example I show a simple OOP example (because I felt like it) and illustrate why using CSS classes is the most powerful way to do row style cycling. Hopefully you're using a decent browser (almost anything other than IE -- I recommend Opera :) but if not then IE7 will suffice to ill

Re: [PHP] Alternate Colors in Rows

2007-10-03 Thread TG
As you can see, a bunch of different ways to skin this particular cat. For fun, I wanted to show you something I came up with early in my PHP career. It's kinda dumb and some of the other ways shown are easier to understand right off the bat, but here is an "alternate" way to do it. My initia

Re: [PHP] Alternate Colors in Rows

2007-10-03 Thread Jim Lucas
Steve Marquez wrote: Greetings, I am attempting to alternate the colors of the container DIV. Anyone know how to do this? Thank you very much, -- Steve M. {$row['optone']} Edit Delete {$study_title} {$row['date']} ROW; } } ?>

RE: [PHP] Alternate Colors in Rows

2007-10-03 Thread Daevid Vincent
Add this to your default.css file... Or to the page... TR.dataRow1 { background-color: #e8f5f7; } /* light */ TR.dataRow2 { background-color: #dce8ea; } /* dark */ Then just do this: > Forget all that $i++ and (mod) % stuff... And NEVER hardcode the colors in the page. Use CSS ! Adjust t

Re: [PHP] Alternate Colors in Rows

2007-10-03 Thread Nathan Nobbe
thats the key use mod 2 and check if the result is 1 or 0. -nathan On 10/3/07, Jon Anderson <[EMAIL PROTECTED]> wrote: > > Steve Marquez wrote: > > I am attempting to alternate the colors of the container DIV. Anyone > know > > how to do this? > > I've used variants of this: > > > > > > jo

Re: [PHP] Alternate Colors in Rows

2007-10-03 Thread Jon Anderson
Steve Marquez wrote: I am attempting to alternate the colors of the container DIV. Anyone know how to do this? I've used variants of this: jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Alternate Colors in Rows

2007-10-03 Thread mike
On 10/3/07, Steve Marquez <[EMAIL PROTECTED]> wrote: > Greetings, > > I am attempting to alternate the colors of the container DIV. Anyone know > how to do this? you could always use javascript we've used something like this with success: http://www.sitepoint.com/article/background-colors-javascr

[PHP] Alternate Colors in Rows

2007-10-03 Thread Steve Marquez
Greetings, I am attempting to alternate the colors of the container DIV. Anyone know how to do this? $optone Edit Delete $study_title $date "; } ?> Thank you very much, -- Steve M.