ZF-5777: Missing details for the url view helper

Issue Type: Docs: Improvement Created: 2009-02-13T07:28:03.000+0000 Last Updated: 2009-02-13T08:02:03.000+0000 Status: Resolved Fix version(s): Reporter: Itay Moav (itaymoav) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_View

Related issues: Attachments:


The description of the url helper for the Zend_Veiw is missing a critical example of the parameters it can get. Instead of just: // from view url function signature: $this->url(array $urlOptions = array(), $name = null, $reset = false, $encode = true);

I would expect something on the lines: // from controller url function signature 1: $this->_helper->url($action, $controller = null, $module = null, array $params = null);

// from controller url function signature 2: $this->_helper->url->url($urlOptions = array(), $name = null, $reset = false, $encode = true);

// from view url function signature: $this->url(array $urlOptions = array(), $name = null, $reset = false, $encode = true); //WHERE $urlOptions Has the following indexes saved for specific use: 'module'=>'module name' 'action'=>'action name' 'controler'=>'controler name' And then the rest of the parameters will be regarded as 'key'='value' in the query string. For exampe: $urlOptions = array('module'=>'M','controler'=>'C','action'=>'A','K1'=>'V1','K2'=>'V2') will translate, using router rewrite into domain/M/C/A/K1/V1/K2/V2 and in a [not sure about the router name] simple router to: domain?module=M&controler=C&action=A&K1=V1&K2=V2



Posted by Matthew Weier O'Phinney (matthew) on 2009-02-13T08:01:42.000+0000

You're confusing two different helpers in the above examples -- the url() view helper and the Url action helper. They have different functionality, and their documentation shows as much.

The URL action helper behaves differently from the url view helper. When called as a method (your second example), it proxies to the class's "simple()" method, which has the same signature as you showed ("url($action, $controller = null, $module = null, array $params = null)"). You can also fetch the helper and call methods directly on it ($this->_helper->url->...); when doing so, you have access to both the "url()" and "simple()" methods.

The url() view helper has one signature, and one signature only:

<pre class="highlight">
string url(array $params, $name = null, $reset = false, $encode = true)

The reason the params are not detailed is because they will vary based on the route used. The examples clearly show usage with the default route, which includes parameters for module, controller, and action.

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.