AndyJarrett

Model Glue - Setting up global variables

Unlike Fusebox there is not a global init variable setting file With MG. If you do need to set up some global vars the way i'm doing this (and seems to be the norm nearly) is:
  1. Set up a cfc called /config/beans/global.cfc
  2. Create an xml file at /config/beans/global.xml - (for my current site this covered about 5-8 smallstructures/arrays/values that is used through out the site)
  3. In the controller add the following line -
    <cfset variables.global = GetModelGlue().GetConfigBean("global.xml") />
  4. and on request start -
    <cfset arguments.event.setValue("global", variables.global) />

Now on any page to get the variable you want you can use
I've seen no documentation on this, but have posted to the Topica List. Sean Corfield has another method using a new controller you can find it on the Topica lists also see the GGCC examples (7/8/9) in his frameworks Pod.


For more information on Config beans in MG see :
Eat Your Beans: ConfigBeans in Model-Glue