> -----Original Message-----
> From: sebastian palmigiani [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 29, 2001 12:01 PM
> To: CF-Talk
> Subject: request scope confusion
>
>
>
> I am trying to understand the request scope.
>
> What is the difference between putting
>
> <cfset DSN = 'foo'>
>
> vs.
>
> cfset request.DSN = 'foo'>
>
> in the application.cfm template or in any template?
When you set a without a scope, it is put in the "VARIABLES" scope, which can only be
accessed by the current page after it has been set, as well as in any cfincludes you
might have in that page, that come afterwards. Using the request scope is basically
the same thing, since the variable will still be lost after the current page is
processed, EXCEPT variables in the request scope are accessible within custom tags,
whereas regular variables are not. Note that scoped variables such as SERVER,
APPLICATION, SESSION, FORM, URL and ATTRIBUTES are available within custom tags as
well.
So to clarify and relate to your question, setting a variable with the request scope
in your application.cfm is different in that all pages and called tags will have
access to that variable (provided you read/write it as REQUEST.DSN), whereas only the
current page being processed would be able to read the variable DSN. Custom tags have
a separate memory space allocated to them, but the aforementioned scopes are
accessible to the called tag even though they are outside the memory space of the
custom tag.
-Andy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists