I want to use the URL schemes in Zend Framework like /list?id=2&name=test, something like that, when I do redirection, I call this way: $this->_helper->redirector('index','list','',array('id' => 2, 'name' => 'test'));
. But the URL generated will be /list/index/id/2/name/test which makes it inconsistent. How do I prepare a URL scheme like this without using custom routers (I have more than 10 controllers to do so...)?
views:
55answers:
1
+1
A:
In your bootstrap.php you can overwrite the default route
$front = Zend_Controller_Front::getInstance();
$router = $front->getRouter();
$route = new My_New_Route( ... )
$router->addRoute('default', $route);
$this->_helper->redirector
uses automatically the default routers assemble method.
Unfortunately there is no integrated router that formats URLs in the way you want (with ?parameter=value& ... instead of /parameter/value)
So if you want to change this, you can make a new class
class MyRouter extends Zend_Controller_Router_Route
and overwrite the assemble function.
Alex
2010-07-23 09:29:46