Issues

ZF-5777: Missing details for the url view helper

Description

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

etc

Comments

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:


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.