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

GetBaseTagList

Last update:
May 18, 2026

Description

Gets ancestor tag names, starting with the parent tag.

Returns

A comma-delimited list of uppercase ancestor tag names, as a string. The first list element is the parent tag. If the current tag is nested, the next element is the parent tag. If the function is called for a top-level tag, it returns an empty string. If an ancestor does not expose data (see GetBaseTagData), its name might not be returned.

Category

Syntax

GetBaseTagList(caller)

Parameters

Parameter
Description
caller
The parameter lets you specify whether to get the base tags from the current template or the parent caller context.

See also

GetBaseTagData; High-level data exchange in the Developing ColdFusion Applications

Usage

This function does not display the following tags or end tags in the ancestor tag list:
This function displays the following tags only under the following conditions:
  • cfloop: if it uses a query attribute
  • cfoutput: if at least one of its children is a complex expression
  • cfprocessingdirective: if it has at least one other attribute besides pageencoding

Example

<!--- This example shows the use of GetBaseTagList function.

Typically used in custom tags. --->

<cfif thisTag.executionMode is "start">

<!--- Get the tag context stack

The list will look something like "CFIF,MYTAGNAME..." --->

<cfset ancestorList = GetBaseTagList()>

<br><br>Dump of GetBaseTagList output:<br>

<cfdump var="#ancestorList#"><br><br>

<!--- Output current tag name --->

<cfoutput>This is custom tag#ListGetAt(ancestorList,1)#</cfoutput><br>

<!--- Determine whether this is nested inside a loop --->

<cfset inLoop = ListFindNoCase(ancestorList, "cfloop")>

<cfif inLoop>

Running in the context of a cfloop tag.<br>

</cfif>

</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