Then again, the best way to do it is probably:

<span class=colourchanger>#Arguments.status#</span> 

And set this in your stylesheet

.... Having got that far, I can't find the syntax I need, but there's a
way to set a style depending on the content of a tag, so it looks like:

A.colourchanger:(content="ONLINE"){color=green}
A.colourchanger:(content="OFFLINE"){color=red}

My syntax is wrong, although the concept is right, but I can't find the
details...  Can anyone finish that for me?  (I know it's not a CF
solution, but hey)

-----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[Scanned]

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












~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:15:723
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

Reply via email to