Rendering a Handler's response into a contentvariable?

I'm in the process of porting a relatively large fusebox 5.5 noxml app
to coldbox 3.. things are going well mostly, but i've hit one
stumbling block..

in fusebox, i used to be able to use contentvariables with in the "do"
method to render pieces of content generated from other fuseactions: action="comments.main", contentvariable="status");

this would execute "comments.main" and stick it in the status
contentvariable, and then the primary fuseaction i'm executing (say
blog.main for example), would load said contentvariable in its view..

This doesn't seem to be possible in coldbox, am i right? renderView
comes close, but then i'm not executing the controller code associated
with that view, just the view itself..

any insight here?


You can use runEvent('somehandler.someevent') and have that event return
the rendered view

<cffunction name="someevent" access="public" returntype="string"
output="false" >
    <cfargument name="event" required="false" type="any" />
      var rc = event.getCollection();
      //Do whatever you need to here
      return renderView(view="someview");

Hope that helps,

Curt Gratz
Computer Know How

worked like a charm! thanks curt!

Similar related question.. In fusebox, I could use the same means to add a few views to my contentVariable as such:'vMail.dsp_message', contentvariable="content", append='true');

in this particular case, "content" is equivalent to my view, so essentially i'm trying to render multiple views.. am i correct in thinking i'd have to call one handler method to render / return BOTH views? or is there an easier way?

I would watch out with doing cv appending. Especially on large strings. Strings in java are immutable that means once created they don't change. Therefore too much string manip or appending will considerably slow down your app. Alternatives would be to use a string buffer or builder.

However the paradigm of cv appending in fusebox does not translate well to coldbox because you have layouts which are much more flexible. Also viewlets and on demand rendering.

I can honestly tell you that I do not use content variables