Notice: With the launch of Adobe Cookbooks, this site will no longer be accepting new entries or posting new content. Thanks to everyone who submitted content!

How can an Application.cfc's extend to other Application.cfc's?

One of the cool things you can do with Application.cfc is to extend it in subdirectories to override behavior for parts of your application. This Tech Note tells you how.


Update: there is a way to extend the root Application.cfc without using a mapping. In your root directory, alongside your root Application.cfc, create ProxyApplication.cfc that contains just these two lines:

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

Now, in your subdirectory's Application.cfc you simply extend ProxyApplication (which CFMX will find in your root directory). It doesn't need mappings so it should help people on shared hosts, as well as keeping your server configuration leaner.

Taken from blog post: http://corfield.org/entry/Extending_Applicationcfc


This question was written by Sean Corfield.
It was last updated on October 19, 2006 at 4:06:58 PM EDT.

CFML Referenced

<cfcomponent>

Categories

Application Management

Comments

Comment made by nobody on October 19, 2006 at 5:31 AM
Does the name matter, is it special?, so long as it's the same? I'd prefer to use the name ApplicationProxy.cfc just so that it sits beside Application.cfc in my directory listing.


Comment made by Tony Petruzzi on October 20, 2006 at 1:08 PM
As with all classes, names don't matter. You can cal it whatever you want.