I couldn't promise to give you an exact definition, but basically, the 
variables scope is the scope for all local variables in the current page 
requests scope. Any variable you set in a template which does not have a 
specific scope explicitly stated will be created in the variables scope.

One use I have found for explicitly using the variables scope is when I have 
both a local variable and a query field with the same name:

<cfquery name="aQuery" datasource="#dsn#">
select
   id,
   name,
   colour,
   etc
from
   someTable
order by
   name
</cfquery>

<cfset colour="red">

<cfoutput query="aQuery">
  The colour of #name# is #colour#<br>
  The colour of #aQuery.name# is #aQuery.colour#<br>
  The colour of local variable "variables.colour" is #variables.colour#
</cfoutput>
<!---
the first two lines above will take their variables from the scope of the 
query being looped over. The last line will force CF to give us the local 
variable value.
--->

<cfoutput>
  The colour of "colour" is #colour#
</cfoutput>
<!---
But as we're outside the query now, we don't need to explicitly prefix
the variables scope to get at locally declared variables.
--->

Sorry I couldn't be a little more succinct. I hope that makes things a 
little clearer. No doubt others will throw their 2pence/2cents worth!

David Hazell


----Original Message Follows----
From: Balazs Wellisch <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: "Fusebox@Topica. Com" <[EMAIL PROTECTED]>
Subject: variables scope
Date: Thu, 30 May 2002 00:21:55 -0700

Could someone please give me an exact definition of the Variables scope? I
couldn't find anything on this in the CF documentation. How does it compare
to the Request and Attributes scopes?


Thanks,
Balazs




_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

==^================================================================
This email was sent to: [email protected]

EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrFMa.bV0Kx9
Or send an email to: [EMAIL PROTECTED]

T O P I C A -- Register now to manage your mail!
http://www.topica.com/partner/tag02/register
==^================================================================

Reply via email to