Do custom tags in application.cfc ignore this.customTagPaths?

470 views Asked by At

Within my root application.cfc I define this.customTagPaths. This is verified to work on all pages, including those in subfolders. Within one subfolder I have an application.cfc that extends this root application.cfc. Pages within this folder still use the correct custom tags so we know that this is working correctly.

However, when trying to use a custom tag within the [subfolder]/application.cfc file itself I believe it is pulling from a different custom tag path. I added some debug information into the custom tag and it outputs when the custom tag is called from a normal page, but does not output when called from the application.cfc. I do not have access to the server to put debugging information in the other custom tag paths to be sure.

Does code in the application.cfc ignore this.customTagPaths and, if so, how do I use the specific tag I need? This custom tag sets a variable in the caller scope, so it cannot be called with a simple cfInclude.

Edit

I will attempt to address some of the questions in the comments here.

The custom tag in question has been simplified down to this code:

    <cfset Caller.groupList = ""> 
    <cfquery name="getGroups">
        SELECT id, name
        FROM groups
        WHERE id = 1
    </cfquery>

    <cfoutput query="getGroups">
        <cfset Caller.groupList = #ListAppend(Caller.groupList, name)#> 
    </cfoutput>
    <cfoutput>Caller.groupList: #Caller.groupList#<br></cfoutput>

The Application.cfc is using this code:

    <cfcomponent extends="RootApplication">
            ............
            <cf_groupList>
            <cfoutput>request.groupList: #request.groupList#<br><br></cfoutput>
    </cfcomponent>

When cf_groupList is called directly from a cfm it writes "Call.groupList: xxxx" out to the page and shows the correct values from the dev database. However, when the Application.cfc runs the custom tag "Call.groupList: xxxx" never appears, but "request.groupList: xxxx" does, and in the latter case it shows the list that we would expect from the live database. Both the live and dev sites are currently on the same server, which we are in the process of changing, but for now I have no debugging information.

The reason I am calling a custom tag from Application.cfc is because this tag is used many other places. Simply copying and pasting the code into Application.cfc would solve the problem, but then we have an issue of duplicated code that we need to remember to update in two places in the future. Using the custom tag in the application.cfc instead of duplicating code seemed like the correct approach.

Mark, you are correct. When placed in the parent Application.cfc the custom tag works correctly. In the child it does not.

0

There are 0 answers