Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 228

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Building Blocks of ColdFusion Applications
Create the first custom tag page
Create a ColdFusion page with the following content:
1
<cf_nesttag2>
2
Save the page as nesttag1.cfm.
Create the second custom tag page
Create a ColdFusion page with the following content:
1
<cfif thisTag.executionmode is 'start'>
<!--- Get the tag context stack. The list looks something like
"MYTAGNAME, CALLINGTAGNAME, ..." --->
<cfset ancestorlist = getbasetaglist()>
<!--- Output your own name. You are the first entry in the context stack. --->
<cfoutput>
<p>I'm custom tag #ListGetAt(ancestorlist,1)#</p>
<!--- Output all the contents of the stack a line at a time. --->
<cfloop index="loopcount" from="1" to="#listlen(ancestorlist)#">
Ancestorlist entry #loopcount# n is #ListGetAt(ancestorlist,loopcount)#<br>
</cfloop><br>
</cfoutput>
<!--- Determine whether you are nested inside a custom tag. Skip the first
element of the ancestor list, i.e., the name of the custom tag I'm in. --->
<cfset incustomtag = ''>
<cfloop index="elem"
list="#listrest(ancestorlist)#">
<cfif (left(elem, 3) eq 'cf_')>
<cfset incustomtag = elem>
<cfbreak>
</cfif>
</cfloop>
<cfif incustomtag neq ''>
<!--- Say that you are there. --->
Last updated 1/20/2012
223

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents