Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As far as I know, you will always get the controller, action and module in the params list as it is part of the default. You could do something like this to remove the three from the array you get:</p> <pre><code> $url_params = $this-&gt;getRequest()-&gt;getUserParams(); if(isset($url_params['controller'])) unset($url_params['controller']); if(isset($url_params['action'])) unset($url_params['action']); if (isset($url_params['module'])) unset($url_params['module']); </code></pre> <p>Alternatively as you don't want to be doing that every time you need the list, create a helper to do it for you, something like this:</p> <pre><code>class Helper_Myparams extends Zend_Controller_Action_Helper_Abstract { public $params; public function __construct() { $request = Zend_Controller_Front::getInstance()-&gt;getRequest(); $this-&gt;params = $request-&gt;getParams(); } public function myparams() { if(isset($this-&gt;params['controller'])) unset($this-&gt;params['controller']); if(isset($this-&gt;params['action'])) unset($this-&gt;params['action']); if (isset($this-&gt;params['module'])) unset($this-&gt;params['module']); return $this-&gt;params; } public function direct() { return $this-&gt;myparams(); } } </code></pre> <p>And you can simply call this from your controller to get the list:</p> <pre><code>$this-&gt;_helper-&gt;myparams(); </code></pre> <hr> <p>So for example using the url:</p> <pre><code>http://127.0.0.1/testing/urls/cat/1/page/1/x/111/y/222 </code></pre> <p>And the code:</p> <pre><code>echo "&lt;pre&gt;"; print_r($this-&gt;_helper-&gt;myparams()); echo "&lt;/pre&gt;"; </code></pre> <p>I get the following array printed:</p> <pre><code>Array ( [cat] =&gt; 1 [page] =&gt; 1 [x] =&gt; 111 [y] =&gt; 222 ) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload