My Custom URL Managers for Model-Glue 3
It recently came up on the Model-Glue mailing list that the baked-in URL Managers in Model-Glue 3 could be a little bit better. In particular, the way they work is that you use the LinkTo function and pass it the event name that you want to link to as well as the name of the parameters that should go in the URL. Their values have to be variables stored in the event — so they could come from a form post, a controller, or if need be, you can set them in your view immediately before use like so:
I found this to be a little bit clumsy in some cases — mostly when I would have done the above, to set the values from the view — and apparently I'm not alone; so I figured I would go ahead and post my custom URL Manager CFCs for you here.
My changes are not that significant, and really only build on the existing functionality (which is left in place for cases where I still want to use it) so that if the second argument to the LinkTo function is a structure instead of a string, I use the key/value pairs from it to populate the link, instead of keys from the string and values from the event.
To use this, save it as a CFC in your Model-Glue application somewhere, and change the default bean definition in your ModelGlue.xml file to point to the new file instead of the default one:
And here is the code for my basic URL Manager CFC:
To make this into an SES URL Manager, you just need to change the formatUrlParameter function definition to be something like the this:
Posted in Model-Glue | No Responses Yet