Solved

Scope order for CF 8

Posted on 2008-10-22
6
799 Views
Last Modified: 2011-09-20
Can someone please list an order of scopes from highest to lowest in CF8?

Thanks.
0
Comment
Question by:WebStalkers
  • 3
  • 2
6 Comments
 
LVL 2

Author Comment

by:WebStalkers
Comment Utility
Actually if you list a small paragraph of what each scope is responsible for your get the full 500 pts.

thanks
0
 
LVL 19

Expert Comment

by:erikTsomik
Comment Utility
Local variables
cfquery
CGI
File
URL
Form
Cookie
Client


Other scopes always need to be scoped:
Server
Application
Session
Request
Attributes
Error
0
 
LVL 19

Assisted Solution

by:erikTsomik
erikTsomik earned 150 total points
Comment Utility
or try this
Function local (UDFs and CFCs)
Thread local (new in CF 8)
Arguments
Variables (local scope)
Thread (new in CF 8)
CGI
CFFile
URL
Form
Cookie
Client
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 2

Author Comment

by:WebStalkers
Comment Utility
Well which is correct?  What about the 'THIS' scope?  Shouldn't that be included? Also in your first message you give me one groupe then another group that need to be included..what in what order?
Also a short description for each would be great,

Thanks
0
 
LVL 3

Accepted Solution

by:
andrewlorien earned 350 total points
Comment Utility
erikTsomik's second list is actually the same as his first list, with the 'local' scope unpacked a bit more.  and the order of both is correct.  ARGUMENTS.userid has priority over URL.userid which has priority over COOKIE.userid.  other scopes not in those lists (eg APPLICATION, SESSION) have to be specified explicitly
'THIS' is part of "function local" (only used in components)

it's good programming practice and more efficient for the server if you explicitly declare all variables - it does make your code a bit cumbersome, but it's worth the hours you save searching for errors.

here's a short-but-good scope definition, from http://www.quackit.com/coldfusion/tutorial/coldfusion_variable_types.cfm (re-ordered with a couple of notes)

Caller      Used within a custom tag to set or read variables within the template that called it.
This      Used within a component to store its own properties.
Variables      This scope refers to local variables that are not specifically reserved for use in custom tags. If you set a variable without specifying a scope, it will automatically belong to the variables scope.
CGI      CGI variables describe the current requests environment, are created automatically, and are read-only. You can't modify a CGI variable, only read it.
URL      Variables passed through the URL (or using the "Get" method on a form) are part of the URL scope.
Form      Variables submitted from a form using the "Post" method become part of the Form scope.
Cookie      Cookie variables are global, and persistent, variables stored on the user's machine.
Client Client variables are stored on the server, either in the registry or a database (but can also be stored in a cookie on the client machine).

these must be explicitly scoped:
Application      Application scope variables are available to a whole application
Request      The Request scope is used for the current request. These variables are non-persistent global variables.
Session      The Session scope is available for the life of a user's session.
Server      Server scope variables are available to all applications on the current server.

another list:
http://www.peachpit.com/articles/article.aspx?p=30497&seqNum=3
0
 
LVL 2

Author Comment

by:WebStalkers
Comment Utility
this is exactly what i was looking fr,  And that seems to be a good ref site btw..thanks
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now