Note that there are some explanatory texts on larger screens.

plurals
  1. POZF2 navigation with skeleton default route
    primarykey
    data
    text
    <p>Currently i'm playing with Zend Navigation in ZF2 and i come across the following problem</p> <p>in my application module i have the following config (default skeleton app)</p> <pre class="lang-php prettyprint-override"><code>.... 'router' =&gt; array( 'routes' =&gt; array( 'home' =&gt; array( 'type' =&gt; 'Zend\Mvc\Router\Http\Literal', 'options' =&gt; array( 'route' =&gt; '/', 'defaults' =&gt; array( 'controller' =&gt; 'Application\Controller\Index', 'action' =&gt; 'index', ), ), ), // The following is a route to simplify getting started creating // new controllers and actions without needing to create a new // module. Simply drop new controllers in, and you can access them // using the path /application/:controller/:action 'application' =&gt; array( 'type' =&gt; 'Literal', 'options' =&gt; array( 'route' =&gt; '/application', 'defaults' =&gt; array( '__NAMESPACE__' =&gt; 'Application\Controller', 'controller' =&gt; 'Index', 'action' =&gt; 'index', ), ), 'may_terminate' =&gt; true, 'child_routes' =&gt; array( 'default' =&gt; array( 'type' =&gt; 'Segment', 'options' =&gt; array( 'route' =&gt; '/[:controller[/:action]]', 'constraints' =&gt; array( 'controller' =&gt; '[a-zA-Z][a-zA-Z0-9_-]*', 'action' =&gt; '[a-zA-Z][a-zA-Z0-9_-]*', ), 'defaults' =&gt; array( ), ), ), ), ), 'info' =&gt; array( 'type' =&gt; 'Zend\Mvc\Router\Http\Literal', 'options' =&gt; array( 'route' =&gt; '/phpinfo', 'defaults' =&gt; array( 'controller' =&gt; 'Application\Controller\Index', 'action' =&gt; 'info', ), ), ), ), ), </code></pre> <pre class="lang-php prettyprint-override"><code>.... 'navigation' =&gt; array( 'default' =&gt; array( array( 'label' =&gt; 'Home', 'route' =&gt; 'home', 'order' =&gt; -1, 'pages' =&gt; array( array( //&lt;-- this isn't working gives a link to /application 'label' =&gt; 'Telefoonboek', 'route' =&gt; 'application', 'module' =&gt; 'application', 'controller' =&gt; 'telefoonboek', 'action' =&gt; 'index', ), array( //&lt;-- this works 'label' =&gt; 'Telefoonboek2', 'uri' =&gt; '/application/telefoonboek', ), array( //&lt;-- this works 'label' =&gt; 'info', 'route' =&gt; 'info', ), ), ), ), ), .... </code></pre> <p>I'm currently only able to make the navigation work when i add a route for "every" item i want in the menu. But this is kind of a weird solution.</p> <p>So is this the right way to make the menu work or do i need to do something fancy with the pages?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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