views:

55

answers:

2

I've seen all kinds of solutions for extending cfcs in parent folders with access to parent files or the CF administration, but I have not seen a workable solution to extend a cfc in a "shared"/sibling folder without access to parent folders.

This solution requires access to parent folders? (Not sure what these mappings are, but I have no access to Application.cfc anyway)

This solution requires being able to create an application.cfc which doesn't work for me (creating one in myApp does nothing because the environment I'm in includes the index page in myApp and builds the from there... the client never directly calls it to fire recognition of Application.cfc)

For instance:

  • wwwroot/some/path/myApp/Shared/Base.cfc
  • wwwroot/some/path/myApp/Function/Function.cfc

I'm looking to be able to call functionality in the Base.cfc (which contains common methods used in the application) from the Function.cfc via super and extension.

I have access to all files within myApp, but not "wwwroot", "some", or "path."

In order to extend Base.cfc within Function.cfc I have to extend the full path of "some.path.myApp.Shared.Base" This would cause problems if someone renamed the myApp folder since I would have to hand edit every Function.cfc that extends that Base.cfc

What I'm looking to do it create an application specific "barrier" so if the app folder name changes it will not cause mass havoc that requires I edit all the CFC files that use functionality from the Base.cfc.

Since I can't use relative paths to the Base ("..Shared.Base") I'm wondering if there's a way to create a CFC in the myApp folder that I can extend from and alleviate the renaming headache if it were to occur or a way to give it a generic name like "myApp" and extend from there. (myApp.Shared.Base)

I do not have access to Application.cfm, nor the Coldfusion administration.

A: 

The easiest way I can see to do this is to create a symlink or junction point to the base directory in the extension function directory.

Unfortunately, it's not a pure CF solution, nor portable if you need to move your code. Hopefully, someone will have a better answer, but this could be a fallback point if none is presented.

Ben Doom
I have no control over the server so this won't do, but it's a good guess. The only issue I see with this is that it would actually still cause the same issue. If you change the path in anyway, the Coldfusion parser would die when trying to extend the path that's not there.
Andir