I've done some searching online to see if this can be done, and haven't found anything that says it can. I have an application.cfc at the root, and have a few subfolders where I want its functions to be the same with just minor differences. For example, the cfc at the root has a function in onRequestStart() that incorporates a function to determine the relative root path for a called template (i.e., whether it should be "../" or "../../", etc., see http://www.bennadel.com/blog/1655-ask-ben-dynamic-web-root-and-site-url-calculations-in-application-cfc.htm).
I want this to run on all pages in all subfolders, but in one subfolder I additionally want to run a security scheme on every request that checks to see if the user has valid permissions to view pages in that subfolder. If I create an application.cfc in that subfolder that extends the cfc at the root, then any onRequestStart() function I place there will overwrite the parent's onRequestStart().
Right now, I'm figuring the only way to make the child's onRequestStart() "the same as the parent's, with just a little extra" is copy the parent cfc's onRequestStart() to the child, and add my extra security code inside it. However, doing this will screw up the function that finds a page's relative webroot path. For pages in that subfolder, the "../../" will be relative to application.cfc in the subfolder, not relative to the parent at the root, which is what's desired.
My hacky way of working around this has been to put code in the parent cfc's onRequestStart():
<cfif cgi.script_name CONTAINS "/mySubFolder/">
(Test the logged-in user's session.roleId; if test fails, cflocation to page that reads "you don't have permissions to view")
</cfif>
And basically do the same for any other subfolders or subsubfolders where I want additional code to run for that subfolder and any of its descendant folders. Which is okay on this particular site as it's not that large, but I see how this could become very messy for a larger site. Is there a better way to do this?
superscope. Refer back to Ben's site for a great explanation about it - bennadel.com/blog/… - Miguel-F