Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You are going to need to read up a bit on <a href="http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.routes.standard" rel="nofollow">ZF Routes</a>. But essentially what you need to do is add something like this to your Bootstrap.php:</p> <pre><code>protected function _initRoutes() { $this-&gt;bootstrap('frontController'); $frontController = $this-&gt;getResource('frontController'); $router = $frontController-&gt;getRouter(); $router-&gt;addRoute( 'name_for_the_route', new Zend_Controller_Router_Route('controller/action/:key1/:key2/:key3', array('module' =&gt; 'default', 'controller' =&gt; 'theController', 'action' =&gt; 'theAction', 'key1' =&gt; NULL, 'key2' =&gt; NULL, 'key3' =&gt; NULL)) ); } </code></pre> <p>The NULL's provide default values.</p> <p>Then in your controller you will do something like this:</p> <pre><code>$key1 = $this-&gt;_request-&gt;getParam('key1'); $key2 = $this-&gt;_request-&gt;getParam('key2'); $key3 = $this-&gt;_request-&gt;getParam('key3'); </code></pre> <p>or use the getParams method you previously mentioned.</p> <p>You can also use PHP's <a href="http://php.net/manual/en/function.array-values.php" rel="nofollow">array_values()</a> function to create a numerically indexed array like so:</p> <pre><code>$numericArray = array_values($this-&gt;_request-&gt;getParams()); </code></pre> <hr> <p>It is a very good idea to get into the habit of using routes as they provide abstraction between what the URI is and what controllers/actions get invoked. Essentially, what you can achieve with routes is object-oriented code that still makes perfect sense to a programmer, while at the same time a URI that makes perfect sense to a user.</p>
 

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