event type


what is the coldbox elegant way to make what Model Glue call event-

Example :

    <event-type name="templatedPage">
          <result do="SomethingThatShouldRunBefore"/>
          <result do="SomethingThatShouldRunAfter"/>

When I apply to an event the type templatedpage I know that all this
operation will be done in addition to what I will do in the current

Any suggestion?



There really are lots of ways to achieve this. Perhaps some examples
on how you intend to use it would yield a more useful reply.


An easy one.
I have an application that in many cases need tho show :

view A ( data for this view are generated by my.cfc eventhandler
method doA )

view B ( data for this view are generated by my.cfc eventhandler
method doB )

I want to invoke them in an implicit way.
So a way to say when event C/D/F/Z fire also fire event A/B and
produce the views I need.

How should you do that?



An d what about if I want to cache A and B using the current event as
a Key.

I believe you’ll want to use the pre/postHandler() methods.


I was just informed (thank you, CJ) that an “event-type” in MG is about a bit more than simply pre-postHandler() stuff. If you’re needing more than just simple pre/postHandler() methods run, then you’ll want to look at into interceptors. They offer a bevvy of interception points (and you can create your own as well) that can be used to “listen” for various events.


Any object in a ColdBox application can be an interceptor, including a handler. Just set the listener object to the desired interception point, and let it do its work.


You can also tell an interceptor to execute on different event patterns

So if you want an interceptor that listens on preProcess for events in a certain regex, and do stuff

<cffunction name=“preProcess” eventPattern="^(admin|users)"

That right there tells that this interceptor will execute on pre process for any events that start with admin or users. You can get very funky with the event patterns. Not only that, you can intercept in over 20 different locations now. So you can do things before the event , before the request, after the request, after the event, etc etc.

Luis F. Majano
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

@matt @luis

Thanks for answering.
Looks great.
I think I will try eventPattern and see what I can do with that.
Looks very promising.