CFDevcon 2008, Brighton, UK

Viewing By Entry / Main
April 28, 2005
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.

Comments

This is coming from a semi-noobish standpoint, but how about tricks for controlling whether Application.cfm is used on a page or not?


Application.cfm will be used if no Application.cfc is found first (per the documentation). Was that what you were asking?


Is the name ProxyApplication.cfc special? Does the name matter 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.


@nobody, you could call it "Fred.cfc" if you wanted. It's just a name.


Post Your Comments
Name:
Email Address:
Comments
*** Please note that all comments require moderation so it may be some time before your comment posts to this blog! ***
Remember My Information:
 



Hosting provided by