Nested Module Issue

I'm playing with nested modules and noticed that when you call a
module B from within module A, event.getCurrentModule() returns Module
A from within Module A.

ModuleA->runEvent("moduleB:default.index")->ModuleB-

event.getCurrentModule() returns "ModuleA"

Seems like this should return "ModuleB".

thanks,

.brett

Another thought... Right now when you call a module with runEvent()
the view the module sets is the view that is requested from the host
application (meaning the runEvent returns the event, THEN the view is
rendered on the host application and the path doesn't match the
module's).

It would be kickass if the runEvent() on a module called the view in
the context of the module that set the view. I can post a test case
if needed, this would be a big feature. Without the view rendering I
think modules act too much like what I would expect plugins to do.

This would be a really cool feature, let me know if I need to
elaborate on it.

What I am working towards is building modules as widgets, and saving
the output as a partial that is rendered in the host app's layout. So
for example one page might have 3 RSS readers widgets on it. Each one
has different settings, url to the feed, how many items to display,
etc... Each saves the output to a webpart and the host app renders
that web parts in the app's template.

Thoughts?

thanks,

.brett

Not necessarily, remember that the event.getCurrentModule() reacts via the event object which models a user’s request not internal event chains. If not, it would be like switching context.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Can you elaborate, I am not following.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

The module I am calling with runEvent() sets the event view but the
renderer tries to find the view relative to the host application and
not from the module that set it. Still getting up to speed with
modules and trying to figure out the best way to call multiple modules
in a single request. As you mentioned before, there is only a single
request context in ColdBox so this is going to be difficult.

.brett

Brett, would a combination of Modules and Viewlets solve your problem?

http://wiki.coldbox.org/wiki/Layouts-Views.cfm#Viewlets

Oooo, it just might. I'll take a look and see.

thanks,

.brett

That guy Aaron is smart :slight_smile: !!

If you want to do just that, I suggest doing viewlets, however, do it by calling the runEvent like so:

//Anywhere
#runEvent('module:myevent.disp")#

Then the event:

function disp(event){

// any logic here

// render it out
return renderView(“mymodule/view”);
}

Then the event is encapsulated and can return the rendered content so you can put it anywhere.
Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Thanks :smiley: