Um exemplo simples de navegação no zend framework 1
Crie um arquivo xml em application / configs /
ex. application / configs / navigation.xml
<?xml version="1.0" encoding="UTF-8"?>
<configdata>
<nav>
<home>
<label>Home</label>
<controller>index</controller>
<action>index</action>
</home>
<about>
<label>About</label>
<controller>index</controller>
<action>about</action>
</about>
<contact>
<label>Contact</label>
<controller>index</controller>
<action>contact</action>
</contact>
<settings>
<label>Settings</label>
<controller>index</controller>
<action>settings</action>
</settings>
</nav>
</configdata>
Adicione isso a application / Bootstrap.php
protected function _initNavigation()
{
$this->bootstrap('layout');
$layout = $this->getResource('layout');
$view = $layout->getView();
$config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml', 'nav');
$navigation = new Zend_Navigation( $config );
$view->navigation( $navigation );
}
Adicione isso a um script de visualização ou a um script de layout, por exemplo. application / layouts / myLayout.phtml
<nav class="myNav">
<?php echo $this->navigation()->menu(); ?>
</nav>
// ->setUlClass('nav'); sets a custom CSS class for the navigation
<?php echo $this->navigation()->menu()->setUlClass('nav'); ?>