I needed to perform some operations when a route was found (by example, for the language, to change the locale in system), but before other chained routes. So, I have writed a new light router, inheriting from Centurion_Controller_Router_Route to do this.
It is a first version, i want to add a new option to allow router to call the method before or after the matching, and why not replace the matching.
To use it :
In your config.in, you must define for this new route, the type Centurion_Controller_Router_Route_Callback and two news options : callback.class and callback.method
I needed to perform some operations when a route was found (by example, for the language, to change the locale in system), but before other chained routes. So, I have writed a new light router, inheriting from Centurion_Controller_Router_Route to do this.
It is a first version, i want to add a new option to allow router to call the method before or after the matching, and why not replace the matching.
To use it :
In your config.in, you must define for this new route, the type
Centurion_Controller_Router_Route_Callback
and two news options : callback.class and callback.methodresources.router.routes.language.type = "Centurion_Controller_Router_Route_Callback" resources.router.routes.language.route = "/:language" resources.router.routes.language.reqs.language = "(en|fr)" resources.router.routes.language.defaults.language = "fr" resources.router.routes.language.callback.class = My_Class_In_My_Project" resources.router.routes.language.callback.method = "Static_Method_To_Call"
Your callback method can accept 4 parameters :