MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual page 189

Developing coldfusion mx applications
Table of Contents

Advertisement

The code accessing sub-tag attributes in the base tag could look like the following:
<!--- Protect against no sub-tags --->
<cfparam Name='thisTag.assocAttribs' default=#arrayNew(1)#>
<!--- Loop over the attribute sets of all sub tags --->
<cfloop index=i from=1 to=#arrayLen(thisTag.assocAttribs)#>
<!--- Get the attributes structure --->
<cfset subAttribs = thisTag.assocAttribs[i]>
<!--- Perform other operations --->
</cfloop>
Ancestor data access
The ancestor's data is represented by a structure object that contains all the ancestor's data.
The following functions provide access to ancestral data:
GetBaseTagList()
string. The first list element is the current tag, the next element is the parent tag name if the
current tag is a nested tag. If the function is called for a top-level tag, it returns an empty string.
GetBaseTagData(TagName
variables (not just the local variables) of the nth ancestor with a given name. By default, the
closest ancestor is returned. If there is no ancestor by the given name, or if the ancestor does
not expose any data (such as
Example: ancestor data access
This example creates two custom tags and a simple page that calls each of the custom tags. The
first custom tag calls the second. The second tag reports on its status and provides information
about its ancestors.
To create the calling page:
Create a ColdFusion page (the calling page) with the following content:
1
Call cf_nesttag1 which calls cf_nesttag2<br>
<cf_nesttag1>
<hr>
Call cf_nesttag2 directly<br>
<cf_nesttag2>
<hr>
Save the page as nesttest.cfm.
2
To create the first custom tag page:
Create a ColdFusion page with the following content:
1
<cf_nesttag2>
Save the page as nesttag1.cfm.
2
Returns a comma-delimited list of uppercase ancestor tag names, as a
,
InstanceNumber=1)
), an exception is thrown.
cfif
Returns an object that contains all the
Nesting custom tags
189

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION MX 61-DEVELOPING COLDFUSION MX and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Coldfusion mx

Table of Contents