RE: [coldbox:12501] Re: Front-Controller Framework Architecture and Services

I have each widget setup up as a controller

When you say that, do you mean it is “handler” in the ColdBox sense, or is it just a model object?

If each widget were a ColdBox handler, I would say render the view in the action and return the HTML results. Then you can have a nice encapsulated call that looks like:
#runEvent(“myWidget.cool”)#
which will output the HTML for that widget.

Let me know if I’m totally misunderstanding what you are doing.

~Brad

Yes I mean handler in a CB sense.

What do you mean by action do you mean my process method in my main
request controller?

If that's what you mean, I was actually, thinking that, as invoking a
runEvent(x.y) is really what should happen.

This would mean however having loops and logic in the
requestController.process() method, which I try to avoid, as I usually
like the controller methods to just act as dumbish navigation objects.

e.g.

Currently I have:

  <cffunction name="process" access="public" returntype="string"
output="false" hint="I execute a request.">

    <!--- process the request --->
    <cfset stuRequest.body =
getFramework().getService("request").process() />

  </cffunction>

this would need to change to something like:

     <cffunction name="process" access="public" returntype="string"
output="false" hint="I execute a request.">

               <cfset template =
getFramework().getService("template").get(templateID) />

               <cfset qryTemplateObjects =
getFramework().getService("template").findTemplateObjectAssignments(templateId=arguments.templateID) /

               <cfloop query="qryTemplateObjects">

                         #runEvent("myWidget.cool")#

               </cfloop>

  </cffunction>

Something like that?