Hi list,
when i use the view helper of Url,i met a problem.what i want is to use
the url helper to construct the right url for the right router.
for example,when i use the default router,it construct the url as *
/news/read/id/1* for me as i call *
$this->url(array('controller'=>'news','action'=>'read','id'=>1)).*
but now,i want to use the url like *?controller=news&action=read&id=1*,so
i remove the default routes.and error occurs when i call *$this->url(array
('controller'=>'news','action'=>'read','id'=>1)).*
sorry for my english.
/**
* case one,use default route
*/
$router = new Zend_Controller_Router_Rewrite();
//$router->removeDefaultRoutes();
$front = Zend_Controller_Front::getInstance();
$front->setRouter($router);
$front->setControllerDirectory('./application/default/controllers');
$front->dispatch();
at this case,i use
$this->url(array('controller'=>'news','action'=>'read','id'=>1)) would
return */news/read/id/1*
/**
* case two,remove default routes
*/
$router = new Zend_Controller_Router_Rewrite();
$router->removeDefaultRoutes();
$front = Zend_Controller_Front::getInstance();
$front->setRouter($router);
$front->setControllerDirectory('./application/default/controllers');
$front->dispatch();
at this case,call $this->url() would produce error.and what i want is it to
return *index.php?controller=news&action=read&id=1*