I have this route setup in one of my bootstrap files...
$route = new Zend_Controller_Router_Route_Regex(
'user/(\d+)',
array(
'module' => 'user',
'controller' => 'view',
'action' => 'index'
),
array(
1 => 'id'
),
'user/%d'
);
$router->addRoute('user', $route);
I am then trying to use the view url helper to buld a href but I keep getting the error 'Cannot assemble. Too few arguments?'.
This is the code for my helper that is generating the link:
$this->view->url(array('controller'=>'user', 'action' => $userID), 'user');
If I take out the 'user' part of the url then it doesnt error but the link doesnt always display correctly.
I thought this was the name and should refer to the name I have entered under addRoute.I have played with d开发者_如何学JAVAifferent settings but I continue to receive an error. Can anyone see where i am going wrong?
Thanks,
Martintry this
$this->view->url(array('id' => $userId), 'user', true);
do not need to supply controller/action again as it's defined in the route (second param), the third param (true) will reset the params from the current request.
精彩评论