Did you know there was a Google group dedicated to writing extensions with ColdFusion Builder? You can find it here. Earlier today Dave Ferguson asked an interesting question. He had an extension with a great number of actions. However, all these actions really just needed to run one particular ColdFusion file. Let's take a look at what he tried first and what a good possible fix could be.

His first attempt/thought was something like this:

<handler id="test1" type="CFM" filename="test.cfm?x=1" /> <handler id="test2" type="CFM" filename="test.cfm?x=2" /> <handler id="test3" type="CFM" filename="test.cfm?x=3" />

Basically - 3 different commands all running one CFM file but passing a URL variable to indicate which type of action should be run. Unfortunately this doesn't work at all. When I tried this the extension said no response was returned.

So what would I recommend? Make use of onMissingTemplate. Consider this example - first - the XML I used in the ide_config.xml file:

<handler id="test1" type="CFM" filename="test2.cfm" /> <handler id="test2" type="CFM" filename="test3.cfm" /> <handler id="test3" type="CFM" filename="test4.cfm" />

None of these files exist. In my Application.cfc I then used:

public boolean function onMissingTemplate(string targetpage) { request.requested = arguments.targetpage; include "test.cfm"; return true; }

All my code here does is take the requested template and store it into the Request scope. Using "requested" as a key in the Request scope may be a bit confusing, but, whatever. I then include the primary CFM that will handle all the requests. Your code could then do whatever it needs to based on the request variable.