Copy link to clipboard
Copied
I have a site that has the Application.cfc that has the cfinclude in it. However, it is appearing on subsites that are also Coldfusion sites. Is there a way to dictate what pages the application.cfc applies to?
Please help
Copy link to clipboard
Copied
Application.cfc is invoked for any CF page. When you request a CF page, it will first check the same directory as the file requested for Application.cfc. If it finds it, it will invoke the methods following the Application life cycle. If it does not find an Application.cfc, it begins to crawl up the file system to the parent directory until it does find one. If none is found, the request is handled through the unnamed application scope, which is generally considered bad practice and can lead to weird issues.
So, if you don't want a specific subdirectory to use the root directory's Application.cfc, then simply create a new Application.cfc within the subdirectory. It will then run in a separate application scope, and will not invoke the root Application.cfc (unless you extended it, of course).