Category: ColdFusion

Extending the root Application.cfc

I spent a great deal of time fighting with something yesterday for no good reason. I was trying to extend the root Application.cfc in my application from an Application.cfc inside a subfolder. Here's what I had in my subfolder's Application.cfc:

<cfcomponent extends="Application">

The problem with this is that CFCs first look in their own directory before walking up to the root of the site, so you'll get errors saying that /Subfolder/Application.cfc can't extend itself.

To get around that you can use another CFC inside the root of your site, that extends your root Application.cfc. I originally suggested this on the CFCDev mailing list using siteroot.cfc, but Sean gave it the more appropriate name of ApplicationProxy. So, in the root of your site (right next to your base Application.cfc), you create a CFC named ApplicationProxy.cfc with nothing but the following code:

<cfcomponent extends="Application">
</cfcomponent>

Then, in /Subfolder/Application.cfc, you use this:

<cfcomponent extends="ApplicationProxy">

Now, /Subfolder/Application.cfc extends /ApplicationProxy.cfc which extends /Application.cfc, and wallah, you're done :)

Hope that keeps someone else from banging their head against the livedocs for a day.

9 comments | Posted by Daniel Short on Apr 13, 2005 at 12:00 AM | Categories: ColdFusion -

Crankin' up da geek

Just thought I'd show off, and let everyone know that I've cranked up the geek factor down here in SoCal...

CFUSION License Plate

That's all :)

18 comments | Posted by Daniel Short on Apr 6, 2005 at 12:00 AM | Categories: ColdFusion - Rambling -

Powered by Detroit

Powered by Detroit is happening this coming weekend. If you haven't already made your reservations, I suggest you do so soon :). The cost is just $349 for the conference, which includes the 2 day conference pass, breakfast and lunch for both days, as well as a DVD of all of the presentations at the conference and $100 off of a Macromedia Certification Exam.

So sign up quick, or else you'll miss a chance to throw things at me in my session...

0 comments | Posted by Daniel Short on Apr 2, 2005 at 12:00 AM | Categories: ColdFusion -