Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It is very simple. Just write in your XML</p> <pre><code>&lt;pages&gt; &lt;editor&gt; &lt;label&gt;Editor&lt;/label&gt; &lt;controller&gt;editor&lt;/controller&gt; &lt;action&gt;edit&lt;/action&gt; &lt;params&gt; &lt;id&gt;42&lt;/id&gt; &lt;someting_else&gt;667&lt;/something_else&gt; &lt;/params&gt; &lt;route&gt;default&lt;/route&gt; &lt;/editor&gt; &lt;/pages&gt; </code></pre> <p>Here is example to do it dynamically based on database data</p> <p>First define Navigation loading plugin. Name the file Navigation.php and place it in application/plugins/ directory. Here's an example of such plugin:</p> <pre><code>class Plugin_Navigation extends Zend_Controller_Plugin_Abstract { function preDispatch(Zend_Controller_Request_Abstract $request) { $view = Zend_Controller_Action_HelperBroker::getExistingHelper('ViewRenderer')-&gt;view; //load initial navigation from XML $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml','nav'); $container = new Zend_Navigation($config); //get root page $rootPage = $container-&gt;findOneBy('sth', 'value'); //get database data $data = Model_Sth::getData(); foreach ($data as $row) { $rootPage-&gt;addPage(new Zend_Navigation_Page_Mvc(array( 'module' =&gt; 'default', 'controller' =&gt; 'examplecontroller', 'action' =&gt; 'exampleaction', 'route' =&gt; 'exampleroute', 'label' =&gt; $row['some_field'], 'params' =&gt; array( 'param1' =&gt; $row['param1'], 'param2' =&gt; $row['param1'] ) ))); } //pass container to view $view-&gt;navigation($container); } } </code></pre> <p>Then in you Bootstrap init this plugin</p> <pre><code>protected function _initNavigation() { Zend_Controller_Front::getInstance()-&gt;registerPlugin(new Plugin_Navigation()); } </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