You have a few choices, really...

You could set up your controller's init method to have something like  
this:

<cfset variables.config = getModelGlue().getBean("Config")>

Then when you need it you can call variables.config.getConfigSetting 
("thumbPhotoDir").

OR you could add a setConfig() method to the controller. This would  
result in the config bean actually getting wired into the controller  
itself. If your setter sets the config bean to variables.config,  
you'd still call variables.config.getConfigSetting("valueName").

OR (and I like this approach best), if you went with option 2 (which  
is a wee tiny bit more performant) and added an onRequestStart()  
message handler to the controller (by message handler I simply mean a  
method that takes the event object as an argument) and then do:

<cfset arguments.event.setValue("config",variables.config)>

Then you'd have to add onRequestStart as a message in the controller  
block of the XML config.

The result of this is that you have your config bean available to  
your views (great for grabbing the thumbPhotoPath for img tags), AND  
you'd have it available to your other controller methods via <cfset  
var value = arguments.event.getValue("config").getConfigSetting 
("varName")>.

It works really well.

J

On Dec 3, 2008, at 12:59 PM, Loony2nz wrote:

>
> Thank you Sean.
>
> I'm assuming this would go in the init function of the controller?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "model-glue" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/model-glue?hl=en

For more about Model-Glue, check http://www.model-glue.com .
-~----------~----~----~----~------~----~------~--~---

Reply via email to