Whatever message this page gives is out now! Go check it out!

GetBaseTagData

Last update:
May 18, 2026

Description

Used within a custom tag. Finds calling (ancestor) tag by name and accesses its data.

Returns

An object that contains data (variables, scopes, and so on) from an ancestor tag. If there is no ancestor by the specified name, or if the ancestor does not expose data (for example,  cfif ), an exception is thrown.

Category

Function syntax

GetBaseTagData( tagname [, ancestorLevels])

See also

GetBaseTagListHigh-level data exchange in the Developing ColdFusion Applications

Parameters

Parameter
Description
tagname
(Required) Ancestor tag name for which to return data
ancestorLevels
(Optional) Number of ancestor levels to jump before returning data. The default value is 1 (closest ancestor).

History

ColdFusion (2018 release): Changed parameter name instanceNumber to ancestorLevels.

Example

<!--- This example shows the use of GetBaseTagData 
 function. Typically used in custom tags.---> 
 ... 
 <cfif trim(inCustomTag) neq ""> 
 <cfoutput> 
 Running in the context of a custom 
 tag named #inCustomTag#.<p> 
 </cfoutput> 
 <!--- Get the tag instance data ---> 
 <cfset tagData = GetBaseTagData(inCustomTag)> 
 <!--- Find the tag's execution mode ---> 
 Located inside the 
 <cfif tagData.thisTag.executionMode neq ’inactive’> 
 template 
 <cfelse> 
 BODY 
 </cfif>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page