Normally when one wants one class (CFC in CF's case) to inherit the behaviour of another class, then one uses EXTENDS on the subclass. Equally, in circumstances in which subclass methods need to replicate whatever the super class' equivalent method does before doing its own specialisation, one calls super.methodName() in the subclass' equivalent method, before doing whatever else it needs to do.
Same with Application.cfc
Hmmm, that makes sense Adam. I have never used that feature before. How do I refer to application.cfc inside the extend? I have tried a couple of things and it says that the class was not found. My main application.cfc is two levels up the blog directory....
Something like this:
<!--- parent.cfc --->
<!--- child.cfc --->
<cfset something = super.f()>
Obviously they'll both be Application.cfc files though. The path you need for the extends is the dotted path from the root of the site (or the root of the mapping the file is in). The easiest way to find the path (as CF sees it) is to rename the Application.cfc you want to extend to app.cfc and then browse to the file. The path is displayed at the top of the ensuing auto-generated documentation file. One needs to rename the file as one cannot browse directly to an Application.cfc file. Obviously rename it back afterwards.
Assuming a structure like this,
and assuming there is a mapping for the root in the Administrator, then you would define the second Application file like this:
<! --- content --->