i second Aaron, but i'd take it a step further and scope the variable
when setting it.

<cfset variables.foo = "bar" />

while there are (rare) occassions when you actually don't want to
scope variables, they're few and far between.  a general rule of thumb
is to scope all of your variables.  including the local (variables)
scope.

On 10/18/05, Aaron Rouse <[EMAIL PROTECTED]> wrote:
> I forgot to mention, I typically will just refer to anything within the
> variables scope with the scope prefixed. So in your exampled I would do
> <cfset foo = "bar" /><cfoutput>#Variables.foo#</cfoutput> I have gotten into
> this happen due to years of working with other peoples code who hardly scope
> much of anything and make it a little harder to debug errors when trying to
> figure out where "foo" came in from.
>
> On 10/18/05, Aaron Rouse <[EMAIL PROTECTED]> wrote:
> >
> > Yeah, <cfset foo = "bar" /> is making a variable named foo within the
> > variables scope.
> >
> > On 10/18/05, Duncan < [EMAIL PROTECTED]> wrote:
> > >
> > > ok so these particular scopes dont get searched through if an unamed var
> > > is
> > > present.
> > >
> > > Do I also understand that if you do this:
> > >
> > > <cfset foo = "bar" />
> > > <cfoutput>#foo#</cfoutput>
> > >
> > > a) foo is actually sitting in the variables scope?
> > > b) and that foo is only available to
> > > - child templates included with cfinclude and
> > > - this current template
> > >
> > > Is this correct?
> > >
> > > On 10/19/05, Nathan Strutz <[EMAIL PROTECTED]> wrote:
> > > >
> > > > Charlie,
> > > >
> > > > You mean:
> > > >
> > > > <cfset application.foo = "bar" />
> > > > <cfoutput>#foo#</cfoutput>
> > > >
> > > > although they'll both throw the same exception.
> > > >
> > > > Duncan, one of my favorite spots in the livedocs (well, it was until i
> > >
> > > > memorized it all...) is this one, dealing directly with your question:
> > > > http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000911.htm
> > > >
> > > > Though, I think i like the one from cfmx 6.0 better:
> > > >
> > > > http://livedocs.macromedia.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/Variables7.htm
> > >
> > > >
> > > >
> > > > -nathan strutz
> > > > http://www.dopefly.com/
> > > >
> > > >
> > > >
> > > > On 10/18/05, Charlie Griefer < [EMAIL PROTECTED]> wrote:
> > > > > I believe those scopes need to be explicitly ...um...scoped :)
> > > > >
> > > > > e.g.
> > > > >
> > > > > <cfset application.foo = "bar" />
> > > > > <cfoutput>#bar#</cfoutput>
> > > > >
> > > > > will result in an error, since CF hunts thru the specific scopes
> > > > > (query, arguments, variables, cgi, url, form, client) and does not
> > > > > encounter 'bar' in any of them.
> > > > >
> > > > >
> > > > > On 10/18/05, Duncan <[EMAIL PROTECTED]> wrote:
> > > > > > I was just thumbing through my CFMX7 Developer Exam StudyGuide and
> > >
> > > > there is
> > > > > > a section that lists the evaluation order of the scopes of CF.
> > > > Something is
> > > > > > bugging me though - when does application. session. server.
> > > request.
> > > > get
> > > > > > evaluated?
> > > > > >
> > > > > > --
> > > > > > Duncan I Loxton
> > > > > > www.sixfive.co.uk <http://www.sixfive.co.uk> 
> > > > > > <http://www.sixfive.co.uk
> > > > <http://www.sixfive.co.uk
> > > > >
> > > > > > [EMAIL PROTECTED]
> > > > > >
> > > > > > "I can only please one person per day. Today is not looking good.
> > > > Tomorrow
> > > > > > isn't looking much better." Dilbert
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:221438
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to