Last active
November 10, 2025 19:21
-
-
Save JamoCA/b67c776d31e9a5c20b63e3a2f72a152e to your computer and use it in GitHub Desktop.
Call this as a custom tag using a CFTag or cfscript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!--- | |
| 11/10/2025 11:17:33 | |
| Custom Tag "thisTag" scope test. | |
| Call this as a custom tag using a CFTag or cfscript | |
| <cf_TestCustomTag> | |
| or | |
| cf_TestCustomTag(); | |
| ---> | |
| <h2>Dump "thisTag"</h2> | |
| <cftry> | |
| <cfdump var="#thisTag#"> | |
| <cfcatch> | |
| <div style="color:red;">ERROR: thisTag scope doesn't exist.</div> | |
| </cfcatch> | |
| </cftry> | |
| <h2>isdefined() should return TRUE (works in ACF 2016-2025 and Lucee 5-7)</h2> | |
| <cfdump var="#isdefined('thisTag.executionMode')#"> | |
| <cfdump var="#isdefined('thisTag.hasEndTag')#"> | |
| <h2>structkeyexists() should return TRUE.</h2> | |
| <cfdump var="#structkeyexists(thisTag, 'executionMode')#"> | |
| <cfdump var="#structkeyexists(thisTag, 'hasEndTag')#"> | |
| <h2>OK... does "variables.thisTag" exist? (Returns TRUE in ACF 2016-2025 and Lucee 5-7)</h2> | |
| <cfdump var="#structkeyexists(variables, 'thisTag')#"> | |
| <h2>Is "thisTag" defined? (Returns TRUE in ACF 2016-2025 and Lucee 5-7)</h2> | |
| <cfdump var="#isdefined('thisTag')#"> | |
| <h2>Is "variables.thisTag" defined? (Returns TRUE in ACF 2016-2025 and Lucee 5-7)</h2> | |
| <cfdump var="#isdefined('variables.thisTag')#"> | |
| <h2>if "thisTag" scope is duplicated, isdefined() works in BoxLang using the duplicated scope.</h2> | |
| <cfset t = duplicate(thisTag)> | |
| <cfdump var="#isdefined('t.executionMode')#"> | |
| <cfdump var="#isdefined('t.hasEndTag')#"> | |
| <h2>WORKAROUND: Using TRY/Catch to capture "thisTag.executionMode" value.</h2> | |
| <cftry><cfset tagMode = thisTag.executionMode><cfcatch><cfset tagMode = ""></cfcatch></cftry> | |
| <cfdump var="#tagMode#"> | |
| <cfif structkeyexists(server, "boxlang")> | |
| <h2>"thisComponent" (BoxLang only) works in BoxLang with isdefined().</h2> | |
| <cftry> | |
| <cfdump var="#isdefined('thisComponent.executionMode')#"> | |
| <cfdump var="#isdefined('thisComponent.hasEndTag')#"> | |
| <cfcatch> | |
| <h2 style="color:red;">ERROR: "thisComponent" should work in BoxLang.</h2> | |
| </cfcatch> | |
| </cftry> | |
| </cfif> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment