That gives the name of the variable, not the value of the variable with that
name:

<cfset variables.bar = "desired string" />
<cfset variables.foo = "bar" />
<cfoutput>#variables.foo#</cfoutput> <!--- bar --->
<cfoutput>#variables[foo]#</cfoutput> <!--- desired string --->

This is different, because the 'var' scope doesn't have a name, so you can't
reference it's variables with structure syntax:

<cfset var bar = "desired string" />
<cfset var foo = "bar" />
<cfoutput>#foo#</cfoutput> <!--- bar --->
<cfoutput>#evaluate(foo)#</cfoutput> <!--- desired string --->

> -----Original Message-----
> From: DURETTE, STEVEN J (AIT) [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 23, 2004 10:47 AM
> To: CF-Talk
> Subject: RE: Scope name of method's local scope?
>
> Actually, I don't think that you even need the scope.
>  
> just try <cfoutput>#i#</cfoutput>  it should work.
>
> -----Original Message-----
> From: Barney Boisvert [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 23, 2004 1:37 PM
> To: CF-Talk
> Subject: RE: Scope name of method's local scope?
>
>
> I don't think the 'var' scope has a name.  At least I've
> never heard of one,
> so I think you have to use evaluate().
>
> Cheers,
> barneyb
>
> > -----Original Message-----
> > From: Jamie Jackson [mailto:[EMAIL PROTECTED]
> > Sent: Monday, February 23, 2004 10:31 AM
> > To: CF-Talk
> > Subject: Scope name of method's local scope?
> >
> > How do I evaluate the members of this list without
> evaluate()? I don't
> > know what scope name the method's local scop uses. A bad example
> > follows:
> >
> >   <cffunction name="badExample" access="public" output="yes"
> > returntype="Collection">
> >     <cfscript>
> >       var i = "";
> >       var myList = "foo,bar,fooBar";
> >     </cfscript>
> >     <cfloop index="i" list="myList">
> > <!--- "variables" is the wrong scope, so what's the correct
> one? --->
> >       <cfoutput>#variables[i]#<br></cfoutput>
> >     </cfloop>
> >   </cffunction>
> >
>   _____  
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to