This post is more than 2 years old.
Brad asked the following question:
In CF 6.1, I have application.cfm in the root directory. It contains a custom tag that records PPC visits. If I have a page in a subdirectory (below root)--what will happen when the custom tag is executed in the application.cfm in the root? I'm using the "CF_" format and not CFIMPORT.
I'm just curious how application.cfm handles paths when executed from a subdirectory that does not have it's own application.cfm.
This is one of those things that I'm always unsure of, so I whipped up a quick test. I wrote an Application.cfm file like so:
<p> Running from Application.cfm </p>
As you can see, I have a simple message and an include as well as a custom tag call. I dropped in a simple index.cfm:
<p> This is index.cfm in root. </p>
I then added a subdirectory named sub and added this index.cfm in that folder:
<p> This is index.cfm in sub. </p>
Running the index.cfm in both the root and child subdirectory worked as expected. Both the include and custom tag call were relative to the root folder. I tested this both in CFMX and CFMX7 to be sure. I also tested it with Application.cfc:
<cffunction name="onRequestStart"> <cfoutput> <p> Running from App.cfc </p> </cfoutput> <cfinclude template="include.cfm"> <cf_tag> </cffunction>
And this also worked fine. Lastly, as a quick off topic note. This particular question came to me in March. As a reminder - I don't reply to all my "Ask a Jedi" stuff immediately. If you send a question and you need an answer asap, please tell me. That doesn't mean I'll answer (I do have a 9-5 ya know ;) but I will at least try to reply back letting you know I can't answer on time.