My application needs to support dynamic THIS scope variables.
As it stands, onApplicationStart, I load an XML config file, parse it, and it contains a structure which mimics the variable structure ColdFusion supports. Problem is, once I'm in the onApplicationStart() I've already passed the pseudo-constructor area where THIS-scoped variables are supposed to be set.
In the onApplicationStart, I could not redirect to the same URL that was requested because I would never get to the <cfreturn true /> that is needed to start the application.
Also, we use URL rewriting, so even though the URL may look like : http://sub.domain.tld/this/that, the actual page being called looks like: /sub/app/templates/request.cfm?path=/this/that
Anyways, in the pseudo-constructor, it checks if the application exists, and if so, iterates over a variable that holds this structure which holds the THIS-scope variables, and puts them into their respective places on subsequent page loads, but, as I understand it, on the first page load, the THIS-scope is not populated, the onApplicationStart runs, creates the variable that stores this data, but even if in the onApplicationStart I put those variables into their rightful place, they don't seem to take effect.
My belief is that because they are being set in the onApplicationStart, this isn't the same as the pseudo-constructor area, and they are not taking effect.
So, I may not be seeing the solution staring me in the face (We HAVE to have dynamically-loaded THIS scope variables though, so "Don't dynamically load your THIS scope variables" won't be a solution)
I'm learning to build a framework, and part of it is the ability for the configuration file (an XML file that I parse), can define application variables. Any suggestions?
I've had to do something similar in one of my apps. In order to populate values in the THIS scope, you'll need to put a copy of the XML loading/processing logic in the pseudo-constructor (or encapsulate it in a separate CFM/CFC file and include it in both places). It's ugly, but that's the only way I'm aware of to access the THIS scope.