Application.cfc and directory mapping
Hello,
We have an application that we would like to migrate from using Application.cfm to Application.cfc. It's a management application that is set up on different web sites (all of which we host) with a common 'app directory' that is set up as a virtual directory off of each site, with some site specific variables (mostly just a couple of unique client IDs) located in an XML file off each site definition's root. In other words:
www.site1.com is client A's web app and has /configfolder/appvars.xml
www.site2.org is the same web app for client B and has /configfolder/appvars.xml
The actual application is a virtual directory, let's say:
This /mgmt/ folder contains all of the actual application code - the only thing that the root directories do is hold the handful of client-specific variables.
Historically, what we've done is to have an Application.cfm file in the /mgmt/ app folder do a <cfinclude template="../Application.cfm"> so that the same code executes for all the sites but pulls the unique site's credentials from that site's parent folder. But Application.cfm is a bit long in the tooth.
The problem is that the server doesn't seem to 'find' the Application.cfc in the parent folder and I'm not sure there's an equivalent 'cfinclude the file from one directory up' (unless you can cfinclude a CFC, which I don't think you can do?). 'extends' won't cut it either because we'd have to set up a mapping and know which specific Application.cfc we're extending, when the only thing we know is that the data we want is in /configfolder/.
The only solution I can think of is to use a single Application.cfc and to put it in /mgmt/, transfer our client-specific variables from the XML file we read in via cffile to a CF page that can be included in the Application.cfc (so we don't need to know the absolute directory name, as we do now), and then set things like Application.name dynamically, but I'm not sure if this is kosher. I'd prefer that each site had its own Application.cfc but (perhaps by dint of it being a virtual directory?) when you go to login at www.site1.com/mgmt/, it just doesn't seem to use www.site1.com/Application.cfc. I have other traditional sites where Application.cfc does 'filter' down to subdirectories, but there it's located in the root folder, you login in the root folder, and when you navigate to a subdirectory, CF seems to be aware that you're still in the same application.
I apologize if I haven't explained this well and am happy to clarify anything -- would appreciate any advice on how to best implement Application.cfc in a multiple-sites-on-one-codebase scenario.
