Dude, did you not read the comments?! <!--- The right way --->, <!--- Neil's way! ---> and the default return "Don't use Neil's way!!!"?! Come on now, code is logic, logic can't be beaten, sooooo, and you know where this is heading, I'm right :OD
See kids, write code like this and you'll always beat the Neil's of this world :OD BTW, Neil's on my messenger so I'm allowed to rip it like this, don't do it at home though, caution must always be observed when using code! :OD -----Original Message----- From: Robertson-Ravo, Neil (RX) [mailto:[EMAIL PROTECTED] Sent: 03 March 2005 16:58 To: CF-Newbie Subject: RE: change font color based on content LOL, Choose whatever floats your boat ;-) I find an inline if more efficient but a cfif is just as good. -----Original Message----- From: Adrian Lynch [mailto:[EMAIL PROTECTED] Sent: 03 March 2005 16:11 To: CF-Newbie Subject: RE: change font color based on content This floated my boat for all of 5 minutes: <cffunction name="RightWayWrongWay" output="no" returntype="string"> <cfargument name="status" required="yes" type="string"> <cfargument name="who" required="no" default="adrian" type="string"> <!--- The right way ---> <cfif ARGUMENTS.who EQ "adrian"> <cfif ARGUMENTS.status EQ "OFFLINE"> <cfreturn "red"> <cfelseif ARGUMENTS.status EQ "ONLINE"> <cfreturn "green"> </cfif> <!--- Neil's way! ---> <cfelseif ARGUMENTS.who EQ "neil"> <cfreturn IIf(yourQuery.Status EQ ARGUMENTS.status, DE("Green"), DE("Red"))> <cfelse> <cfreturn "Don't use Neil's way!!!"> </cfif> <cffunction> Wow, I haven't had a funny code session in a while :OD Ade -----Original Message----- From: Robertson-Ravo, Neil (RX) [mailto:[EMAIL PROTECTED] Sent: 03 March 2005 15:53 To: CF-Newbie Subject: RE: change font color based on content Hee hee, sorry ;-) force of habit...too many lists to reply to, but its one of those things which if you learn from the start you to grips with CF quicker. It is well known fact that most CF'ers only use about 10 or so CF tags in their developments - get to grips with others and it makes you a better coder IMHO.. Either option will work - see what floats your boat ;-) -----Original Message----- From: Adrian Lynch [mailto:[EMAIL PROTECTED] Sent: 03 March 2005 15:51 To: CF-Newbie Subject: RE: change font color based on content Dude, you can't be posting that to a newbie list!!! :Oo :OD I like smaller inline code like that but I've learnt to stay away from 'immediate if'. I did go through a phase of using it but I used to do that all the time just to see have I got on using things. Ade -----Original Message----- From: Robertson-Ravo, Neil (RX) [mailto:[EMAIL PROTECTED] Sent: 03 March 2005 15:39 To: CF-Newbie Subject: RE: change font color based on content To me, this would be more efficient IIf(yourQuery.Status EQ "Online", DE("Green"), DE("Red")) -----Original Message----- From: Adrian Lynch [mailto:[EMAIL PROTECTED] Sent: 03 March 2005 15:34 To: CF-Newbie Subject: RE: change font color based on content <cfif yourQuery.Status EQ "OFFLINE"> colour the font red here <cfelseif yourQuery.Status EQ "ONLINE"> colour the font green here </cfif> Something like that? Ade -----Original Message----- From: Scot VanAlstine [mailto:[EMAIL PROTECTED] Sent: 03 March 2005 14:32 To: CF-Newbie Subject: change font color based on content Here's a fun one. I have written a little app that lists the status info on 4 different printers in our building. It reads the data from a database and displays it on a status webpage. What I would like to do is if the status field reads "OFFLINE" display it in a red font. If the status field reads "ONLINE" display it in green font. I haven't a clue on how to do it. Anyone?? -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.6.0 - Release Date: 02/03/2005 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:15:722 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
