Eric,

Yes.. (and sorry for the delay in answering)... You are correct... It was a
typo. It should have read <cfoutput>#variables["x"]#</cfoutput> ... My bad
:) 


Mark A. Kruger, CFG, MCSE
(402) 408-3733 ext 105
www.cfwebtools.com
www.coldfusionmuse.com
www.necfug.com

-----Original Message-----
From: Eric Roberts [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 10, 2008 11:19 AM
To: CF-Talk
Subject: RE: How NOT to Evaluate (moved from cfset so not to confuse topic)

There is an order of precedence (which I don't remember offhand) that CF
looks at when a variable isn't scoped.  It goes down the list until it finds
a variable with a value.

Mark...I do have a question, with your cfoutput statements below...are you
saying that those three would output the same?  Lets assume x=2...wouldn't
variables[x] return whatever the 2nd element is in that object (assuming it
is stored as an array)?  What if x="q"...wouldn't that throw an error since
the array sub(I forget the actual term) has to be numeric?
Eric

/*-----Original Message-----
/*From: Mark Kruger [mailto:[EMAIL PROTECTED]
/*Sent: Wednesday, September 10, 2008 10:19 AM
/*To: CF-Talk
/*Subject: RE: How NOT to Evaluate (moved from cfset so not to confuse
/*topic)
/*
/*David,
/*
/*Everything in CF (starting with CFMX and partially before that) is an
/*"object" that has a "parent".
/*
/*
/*For example, if I do the following:
/*
/*<cfset x = 10/>
/*
/*I have created a "member" of the "variables" scope ("variables" is the
/*object and "x" is the member).
/*
/*So I could do the following with x:
/*
/*<cfoutput>#x#</cfoutput>
/*
/*<cfoutput>#variables.x#</cfoutput>
/*
/*<cfoutput>#variables[x]#</cfoutput>
/*
/*
/*This is true of every scope in CF - application, variables, form, url,
/*arguments, attributes, request, server, session..... Each of these are
/*objects with members.
/*
/*Why does <cfoutput>#x#</cfoutput> work you ask? Because when CF sees a var
/*that has no parent object specified it looks in the variables scope
/*(followed by url and then form) and figures it out for you. This is done
/*for /*convenience but the abstraction keeps you from understanding what is
going /*on under the hood.
/*
/*-Mark
/*
/*
/*
/*
/*Mark A. Kruger, CFG, MCSE
/*(402) 408-3733 ext 105
/*www.cfwebtools.com
/*www.coldfusionmuse.com
/*www.necfug.com
/*
/*-----Original Message-----
/*From: David Moore, Jr. [mailto:[EMAIL PROTECTED]
/*Sent: Wednesday, September 10, 2008 9:44 AM
/*To: CF-Talk
/*Subject: RE: How NOT to Evaluate (moved from cfset so not to confuse
/*topic)
/*
/*Adrian Wrote:
/*
/*> SELECT *> FROM Contacts> WHERE Contacts.ContactType = 'Physician'> AND
/*> Contacts.#FORM.Field# = '#FORM[FORM.Field]#'> ORDER BY /*>
Contacts.LastName
/*
/*What is the [] for. How would they be used. I have never used them at all.
/*What is the protocal. Is that CF or SQL or... > And then throw in some
/*cfqueryparams.
/*I am just starting to write in the cfqueryparams. That is a new one too.
/*
/*~David
/*_________________________________________________________________
/*Want to do more with Windows Live? Learn "10 hidden secrets" from Jamie.
/*http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-
/*cns!55
/*0F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008
/*
/*
/*
/*



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:312360
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to