handlersExternalLocation and Modules

I have an app which heavily uses viewsExternalLocation and LayoutsExternalLocation to allow different “sites” to use the same app and get highly customised.

My app also has 3 modules, and using viewsExternalLocation I can create custom views for the modules.

So, my app (mygreatapp) has a viewsExternalLocation set as “/views”, and a viewsLocation set as “/custom/1”.

To create a custom view for a module (let’s say module is called myfirstmodule), I can do:

/views/custom/1/modules/myfirstmodule/welcome.cfm inside my main app, which allows the custom view for the site for the module. All works brilliantly!

But let’s say I want a custom handler for that module. How do I do that? Is it even possible?

For the main app, I can obviously do /handlers/custom/1/myhandler.cfc – but for a module, where would I put the “custom” handler? I’ve tried “/handlers/custom/1/modules/myfirstmodule/myhandler.cfc – but it doesn’t pick it up.

I know there is a “modulesExternalLocation”, but I don’t really want to duplicate the entire module, I just want the odd custom handlers here and there…

Anyone done this before?

Thanks,

Tom.

handlersExternalLocation

Yep I’m aware of handlersExternalLocation. That works fine with my main app.

But I can’t get it to work with a module.

Also, where do I put them? In my main app (like custom module views), or in the module?

Also moduleConfig doesn’t seem to support handlersExternalLocation?

Have that not been added to the conventions structure?

Tom,

Presently there is not a way to do this, you can only overwrite the whole module in that situation.

One trick I have done if the module is mainly the same is to use inheritance and have the now “local” modules handlers extend the “external” equivalent handler to reduce duplicate code.

Might be worth looking into for a feature request though.

Curt

Hi Curt,

Yep that’s what I thought.

It would be nice to have a handlersExternalLocation which you could specify inside the ModuleConfig.cfc – or even a “handlersParentLookup” like with views/layouts.