0

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 different settings but I continue to receive an error. Can anyone see where i am going wrong?

Thanks,
Martin

1 Answer 1

2

try 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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.