Zend MVC load config based on parameter in Url. Where is the right point dispatch/router/controller?
I'm defining a partner through a route based on the url e.g.
my.domain.com/:partner/:controller/:action
Now I want load the c开发者_开发问答onfig file, databases for the partner before the front controller is called.
- Where do I locate this code?
- How do I get/set the variables/db, that they are later available in the controller?
I know I could do this through a controller helper but I guess this is not the best point to do it?
Yes, a controller plugin is the way I'd do it:
class MyPlugin extends Zend_Controller_Plugin_Abstract
{
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
switch($request->getParam('partner')) {
//... do something based on the possibility
}
}
}
精彩评论