Updating old code, questions about cfcs and functions
The site I manage is spit into four directories on our web server, and most of the code to get things running is leftover from CF6. As such, each of these folders contains an application.cfm file, but the only thing that file does is <cfinclude> our master file. (I can't have an application.cfm on root, because that would hit folders that belong to other people)
I'm getting ready to do a complete facelift on all of our pages, so I think this would be the perfect time to update the code and bring it into the 21st century. One of our current problems is that we have header and footer includes in each file, and those includes get hosed sometimes when we do global search replaces. I'd like to use Application.cfc to bring the header and footer includes into the page (which I've successfully done before) and leave those includes off the page.
My biggest challenge will be getting the new Application.cfc files to do the same thing our current master file does (I think I'll need four separate application.cfcs, because I think that's the only place I can do OnRequest(), correct?)
Currently the master file does:
1) Sets a bunch of global variables that the pages use.
I can do this using OnSessionStart(), correct? If so, how will session timeouts affect the pages that use these variables?
2) Defines a number of functions using cfscript and cffunction.
I can move these into their own cfcs, but the way it works now, those functions are available on any page I want to call them on, without doing a separate cfinvoke or anything. What's the best way to replicate this? Can I define these in Application.cfc? If so, where?
I'm assuming I shouldn't just use the same master file and include it somewhere (like OnSessionStart) in the new Application.cfc. I mean, that would be easy, but is it the proper way to do it?
