Okay, I think I'm getting somewhere.

First, you can create an array in the attributes scope.  The following
works.
        ---------------------------------------------------------
        <cfset attributes.test=arraynew(2)>
        <cfoutput>#arraylen(attributes.test)#</cfoutput>
        ---------------------------------------------------------

I created a custom tag called <cf_test>:
        ---------------------------------------------------------
        <!--- test.cfm --->
        <cfoutput>
                #IsStruct(attributes)#
        </cfoutput>
        ---------------------------------------------------------
When calling the custom tag above <cf_test>, the result is "yes".
"Attributes" must be a default structure within a custom tag.


I then changed <cf_test> to this:
        ---------------------------------------------------------
        <!--- test.cfm --->
        <cfset attributes.temp=structnew()>
        <cfoutput>
                #IsStruct(attributes.temp)#
        </cfoutput>
        ---------------------------------------------------------
Again, the result was "yes".

So, why can you create an attributes scoped structure inside of a custom
tag, but not in your normal template?

I'm concluding that the attributes scope has to be a structure first, and
then you can nest a structure inside it.

The following works fine in a normal template:
        ---------------------------------------------------------
        <cfset attributes=structnew()>
        <cfset attributes.test=structnew()>
        <cfoutput>#isstruct(attributes.test)#</cfoutput>
        ---------------------------------------------------------

Is this a bug?  Anyone else have an opinion?

Brad


> -----Original Message-----
> From: Howarth, Craig (IBK-NY) [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 24, 2001 2:20 PM
> To: CF-Talk
> Subject: RE: Attributes Scoped Structure?
>
>
> This is interesting and I don't have an answer.  Perhaps someone
> else can explain this.
>
> The statement
>
> <cfset attributes.temp=structNew()>
>
> will fail as described below if placed in a standard template,
> but works fine in a custom tag.  This led to my response to Brad.
>  Not being a Fuseboxer, I should have experimented further.
>
> As Jason points out the following works fine in a standard template:
>
> <cfset attributes.temp=3>
>
> Why the difference with assigning simple values to attributes
> scope as opposed to structures?
>
> > -----Original Message-----
> > From:       Jason Lotz [SMTP:[EMAIL PROTECTED]]
> > Sent:       Thursday, May 24, 2001 11:58 AM
> > To: CF-Talk
> > Subject:    Re: Attributes Scoped Structure?
> >
> > That's not true.  Fusebox uses nothing but Attributes scoped
> variables.  You
> > can set Attributes variables anywhere.
> >
> > ----- Original Message -----
> > From: "Howarth, Craig (IBK-NY)" <[EMAIL PROTECTED]>
> > To: "CF-Talk" <[EMAIL PROTECTED]>
> > Sent: Thursday, May 24, 2001 7:36 AM
> > Subject: RE: Attributes Scoped Structure?
> >
> >
> > Brad,
> >
> > The attributes scope can only be used within a custom tag.  This is the
> > error message that you get when you attempt to assign a value to the
> > attributes scope in a normal template.
> >
> > Craig
> >
> > > -----Original Message-----
> > > From: Brad Roberts [SMTP:[EMAIL PROTECTED]]
> > > Sent: Thursday, May 24, 2001 9:55 AM
> > > To: CF-Talk
> > > Subject: Attributes Scoped Structure?
> > >
> > > Can you set a structure in the attributes scope?
> > >
> > > I'm wondering why this isn't working:
> > >
> > > <cfset attributes.temp=structnew()>
> > >
> > > I get the following error:
> > > Cannot assign result to symbol attributes.temp
> > >
> > > Thanks in advance,
> > >
> > > Brad
> > >
> > >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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

Reply via email to