<CFASSOCIATE> Is used when associating child tags with a parent tag. For
example:
<CF_Menu [some attribs]>
        [some code]

<CF_MenuItem [some attribs[>
        <CFASSOCIATE basetag="CF_Menu" datacollection="data">

Here we are associating the tag CF_MenuItem with the parent tag CF_Menu
which means we can use the two tags in the following manner:
<CF_Menu>
        <CF_MenuItem label="label 1" URL="URL 1">
        <CF_MenuItem label="label 2" URL="URL 2">
        <CF_MenuItem label="label 3" URL="URL 3">
</CF_Menu>
And the Menu.cfm (aka CF_Menu) template will have access to the attributes
that were passed into the child tags (CF_MenuItem) as an array of
structures, e.g.
data[1].label would contain the value "label 1"
data[2].url would contain the value "URL 2"
and so on.


ATTRIBUTECOLLECTION is a handy way of passing multiple attributes into a tag
there the number of attributes may vary. For example:
<CF_SomeTag attrib1="value1" attrib2="value2">
would be equivalent to:
<cfset MyStruct=StructNew()>
<cfset mystruct.attrib1="value1">
<cfset mystruct.attrib2="value2">
<CF_SomeTag attributecollection=#MyStruct#>

BE WARNED: The way attributecollection works has changed dramatically
between 4.01 and 4.5:
You can mix and match attribute collection with normal attributes and where
a 'real' attribute has the same name as one of the keys that is being passed
in through attributecollection, the 'real' attribute takes precedence in
4.01. In 4.5 it would appear that the key held within attributecollection
takes precedence over the 'real'attribute. Go figure.

Hope this makes sense

Steve

> -----Original Message-----
> From: Chris Hayes [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 02, 2000 15:12
> To: [EMAIL PROTECTED]
> Subject: Nested Recursive Custom Tags AttributeCollection Nightmare
>
>
> I have a tag which is going to call itself many times over.
>
> I want to be able to create a structure, call the custom tag and be left
> with a modified structure at the end of it.
>
> <cfset myStructure = StructNew()>
> <cfmodule template="acustomtag.cfm" AttributeCollection="#menuStructure#">
>
> In the module "acustomtag.cfm":
>     Update the stucture with new values and under certain conditions:
>     <cfmodule template="acustomtag.cfm"
> AttributeCollection="#menuStructure#">
>
>     This will creat a many-tiered hierachy of nests of the same tag.
>
> Upon return to the calling script I should have the modified structure
> "myStructure".
>
> I have read the manual and it left my brain tangled.  Can somebody please
> clarify the syntax and usage of "AttributeCollection" and "CFAssociate" in
> order to get this monster working...
>
> cheers in advance
>
> Chris
>
> ------------------------------------------------------------------
> ------------
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to