CFLib.org – Common Function Library Project

customTagContext()

Last updated May 09, 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>

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson