Organising your ColdBox Handlers into Packages

Posted by Mark Drew on code on April 15, 2010

Tagged under

I have been using Coldbox for a project for a few months now and like the framework. I won't get into all the features, since you can find out for yourself over at http://www.coldbox.org but one of the things that you realise once your project grows is that your handlers directory starts getting rather full of handler CFC's.

It took me a little while to see how I could package them up a little better but then I spotted a small bit of the docs that tells you how to do it, so for example, if you were calling your handler as:

     http://localhost/index.cfm?event=account.create

And you have moved your account handler to a /user folder you can now call it as a package:
http://localhost/index.cfm?event=user.account.create

Of course, this isn't ideal, so you can now add a route for it in your routes.cfm file (if you have routes turned of of course):

   addRoute(pattern="account/create", handler="user.register", action="new");

  <p>And now you can have a nice SES friendly url such as:     http://localhost/account/create   
Hope that helps people looking for how to do this!</p>




comments powered by Disqus