Subsribe to our RSS

latest reactions

Montana Flynn
haha …
some1
Hi, Thank you for help me testing my sit …
metin2 yang
it is very nice …
Tjarko
I would'nt use cfhtmlhead for anything ; …
Sebastiaan
Hi Tjarko,Would you suggest injecting…

Use OpenDNS

mxna feeds

ColdFusion Job Opportunity in Southern Kent, United KingdomColdFusion Job Opportunity in South Croydon, United KingdomColdFusion Job Opportunity in Adelphi, MDColdFusion Job Opportunity in New York, NYHermes: ColdFusion API for hooking up to Eventbrite.com APIRemember ColdFusion?March 30th – A Special Adobe ColdFusion Builder EventColdfusion, CAC Cards, and File Uploads over 48k Oh My!Moving Pic of the Day Foiled AgainA Special ColdFusion Builder Event in Tampa, FLColdFusion Contract Job in Marbella, SpainColdFusion Job Opportunity in West London, United KingdomColdFusion Job Opportunity in Bethesda, MDColdFusion Job Opportunity in Springfield, MOColdFusion Job Opportunity in Seattle, WA

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

MXNA webfeed

Visit Carlos GallupaPowered by ColdFusion MX

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

5310 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!!