CFLib.org – Common Function Library Project

customTagContext()

Last updated May 9, 2003

author

Matthew Walker

Version: 1 | Requires: CF6 | Library: UtilityLib

Description:
customTagContext returns the absolute path of the calling template of a custom tag. This is useful where the custom tag may want to access resources relative to the path of the calling template rather than relative to the path of the tag. This code may be adapted for CF5 by inserting it directly rather than calling as a UDF, and changing the "3"s to "2"s.

Return Values:
Returns a string.

Example:

<cfoutput>#customTagContext()#</cfoutput>

Parameters:

No arguments.

Full UDF Source:

<!---
 Return the calling template for a custom tag.
 
 @return Returns a string. 
 @author Matthew Walker (matthew@electricsheep.co.nz) 
 @version 1, May 9, 2003 
--->
<cffunction name="customTagContext">
	<cfset var parentTemplate = "">
	<cftry>
		<cfthrow>
		<cfcatch>
			<cfif arrayLen(cfcatch.tagcontext) gte 3>
				<cfset parentTemplate = cfcatch.tagcontext[3].template>
			</cfif>
		</cfcatch>
	</cftry>
	<cfreturn parentTemplate>
</cffunction>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson