I'm trying to capture a URL parameter in my bootstrap file but after several attempts I'm not able to do it.
I've tried this but it does not work:
protected function _initGetLang() {
$frontController = Zend_Controller_Front::getInstance();
$lang= $frontController->getParam('lang');
}
Is this the right way to do it?
Thks.
You won't be able to access the request params from the bootstrap because it hasn't yet gone through the dispatch/routing process. I think you'd be better served by using a Controller Plugin, performing actions based on the URL is what they do best. Or if you absolutely have to do it in the bootstrap,
getRequestUri()
or$_GET
is available, or you could write a quick script to parse the url yourself.Edit:
I've done some silly stuff like this in the past before I figured out how plugins work:
This would at least give you a module name that you could
switch
on in the bootstrap. You should be able to do anything you need with the plugins done correctly though.