2

I want URL in controller method from the route.

$route = $this->url('my/route', array('id' => $myID), array(
                'force_canonical' => true,
                    ));

This will give me the route object but what I want is URL like

$link = "http://example.com/my/route/23" 

in a variable as I have to send it to other action for display as text.

1 Answer 1

3

you can generate URL from route this way :

$params = array('id' => $myID);
$url = $this->url()->fromRoute('my/route', $params);

Doc: (http://framework.zend.com/manual/current/en/modules/zend.mvc.plugins.html)

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.