Subsribe to our RSS

latest reactions

christian louboutin shoes
With that kind of traffic you want to ad …
Rahul Anand
Thanks for the nice post. It works for m …
Serkan
thx a lot! …
msb
Thanks for above solution.There is ano …
Lori S.
FYI, I was using this successfully in CF …

Use OpenDNS

mxna feeds

cfmailparam behaviour change in CF9.01ColdFusion Job Opportunity in Houston, TXFacial Recognition in 14 Lines Of ColdFusionColdFusion UPS PackageColdFusion Job Opportunity in Arlington, VAColdFusion Job Opportunity in San Diego, CASome ColdFusionBloggers.org GuidelinesColdFusion Positions In CaliforniaListChangeDelimsunix epoch with coldfusionQuery scripting bug in Coldfusion 9Scoth On The Rock 2011 Tickets on salefoursquareCFC updated to version 1.0, now includes ColdFusion return typeFramework One Birds of a Feather session at CFUnitedWhat makes you a good ColdFusion programmer?

All files are strictly confidential: all information is classified.
© Copyright 2002 - 2010 mximize.com.
All right reserved.

MXNA webfeed

Visit Carlos Gallupa

Coldfusion scopes and the order of precedence

If you do not specify the scope of the variable, according to the docs, CF will search for it in the following order (this is called the order of precedence):

  • Local variables
  • cfquery
  • CGI
  • File
  • URL
  • Form
  • Cookie
  • Client

Other scopes always need to be scoped:

  • Server
  • Application
  • Session
  • Request
  • Attributes
  • Error

5939 viewed | 6 opinion(s)  | del.icio.us | Digg it | Tjarko @ 20/06/07 15:33 cet


Reactions:

barrry.b wrote.... (mail)

I'm not sure if this is the case in CF8 but in earlier versions, that precedence checking happens within a CFC as well. it doesn't just stop with the variables and this scope, it continues on to form, url, cookie, etc...

20 June 2007 16:07 cet  

Tjarko wrote.... (site)

I'm not sure what you mean by that?? The form, url and cookie scope are in the list... It's just the order that ColdFusion looks at your variable if you don't scope it.

20 June 2007 16:09 cet  

Cutter wrote.... (site)

I think what barrry.b was trying to say is that CFCs work in a slightly different fashion than a standard cfm template, as far as order of precedence is concerned. You have function-local variables (those initialized with the 'var', and do not have a scope prefix) that are always first, even over the VARIABLES scope. There is also the THIS scope within CFCs, though I am not sure of their scope precedence location off the top of my head (I never use 'em).

20 June 2007 19:42 cet  

Tjarko wrote.... (site)

This THIS scope that everybody is referring to.. is this used by anyone... this?? ;-) Sorry.. could resist!

20 June 2007 20:26 cet  

jax wrote....

Yes, I use it on some vars in my CFC's. When I explicitly want to access the var directly from outside the CFC.I useit for instance with a global logging mechanism I implemented based on Log4J.

This is cool.

:-)

20 June 2007 21:46 cet  

Allen wrote....

cfquery is not a scope

29 May 2009 20:56 cet  

Leave your comment

Your name


Your url/website/link/email....


Some room for your reaction is placed here..



The answer to the ultimate question is?? (42 ;-))




URL en mail addresses are translated for you... life sometimes is that simple!!