Mark Drew (Redux)- cf_etc...

a compendium of railo, cfml, cfeclipse and technology topics

Mark Drew (Redux)- cf_etc...

Organising your ColdBox Handlers into Packages

April 15, 2010 · 3 Comments

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");

 

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!

Tags: coldbox

3 responses so far ↓

  • 1 Glyn // Apr 16, 2010 at 1:00 PM

    Nice isn't it! Love ColdBox.

    O course now with ColdBox M5 you can package your application into modules. makes working with different parts of your system real easy. Needs a bit more planning tho.
  • 2 Mark Drew // Apr 16, 2010 at 1:03 PM

    I am weary of bleeding edge frameworks. I did a whole bunch of stuff in 2 that then was "out of date" by 3. and a review of the code told me it was wrong. err... not at the time it wasn't!

    There are some issues with the documentation (so much of it!) that it either needs more examples or something, I find myself looking for things for a long while in the docs.

    But apart from that I am liking the framework.
  • 3 Glyn // Apr 16, 2010 at 1:28 PM

    I agree, not recommended for a live project just yet, but still worth a play and is stable enough to get some examples out.

    been playing with M4 release now for a while, a few bugs, but most have been sorted over the last set of updates.

Leave a Comment

Leave this field empty: