2 Replies Latest reply on Sep 18, 2013 10:18 AM by Aegis Kleais

    Dynamically loading THIS scope values from a config file

    Aegis Kleais Level 3

      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?