Zend Framework - multiplate navigation blocks
I have had this exact same issue. I just create multiple instances of Zend_Navigation_Container in my controllers for each of the menus I need, pass them to the view and then render them by passing the objects directly to the menu render method. As follows:
In the controller:
$this->view->menu1 = new Zend_Navigation_Container();
$this->view->menu2 = new Zend_Navigation_Container();
In the view:$this->navigation()->menu()->renderMenu($this->menu1);
$this->navigation()->menu()->renderMenu($this->menu2);
You could even customise each one (by inserting method calls after the initial menu() call:$this->navigation()->menu()->setUlClass('my_first_menu')->renderMenu($this->menu1);
$this->navigation()->menu()->setUlClass('my_second_menu')->renderMenu($this->menu2);
Zend_Navigation: Having trouble getting breadcrumbs to render using multiple containers
This is probably a dirty solution, but I manually set the container reference using Zend_Registry like so:
Zend_Registry::set( 'nav' . $menu, $container );
And spit it out like so:$main = Zend_Registry::get( 'nav' . $this->mainMenuId );
echo $this->navigation( $main )->breadcrumbs()->setMinDepth(0);
Zend Navigation - various navigation blocks
findOneByLabel('acc_nav');
will search for text in <label>
-tags as there is nog acc_nav value. It won't find it.
Different Navigation Menus for Controller Views - Zend Framework
Personnaly, my navigation menu is stored in an XML file. When I create my "Zend_Navigation", I load only on part of my navigation menu like this :
$navigation = new Zend_Navigation(new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml', $controllerName));
$view->navigation($navigation);
Where "$controllerName" is a section of my "navigation.xml".In your view:
<?php echo $this->navigation()->menu()->renderMenu(); ?>
Enjoy Zend Framework: Navigation XML and duplicate page elements
You can't use the first XML structure, because Zend_Navigation
uses the Tag definition to create a part of the "Route". If you want use an another type of XML structure, you probably have to extend Zend_Navigation
with your own parsing process.
$config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml');
$container new My_Navigation($config);
Another way would be to create a class to parse and modify the XML document before sending it to Zend_Navigation
.$config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml');
$navigationStructure = new My_Navigation_Parser($config);
$container new My_Navigation($navigationStructure);
Related Topics
Make Script Execution to Unlimited
How to Find "Related Items" in PHP
How Would You Transform a Pre-Existing Web App into a Multilingual One
How to Detect If a Database Table Exists with Laravel
Extend Request Class in Laravel 5
Best Way to Identify a User Uniquely
Create a Zip File Using PHP Class Ziparchive Without Writing the File to Disk
Converting JSON to CSV Format Using PHP
Php: How to Read a File Live That Is Constantly Being Written To
Codeigniter 4 Problem Installing with Composer
PHP Displaying Unread Mail Count
Yii Framework 2.0 Login with User Database
PHP to Easyphp MySQL Server 1 Second Connection Delay
PHP Looping Through Multiple Arrays
How to Create a PHP Function That I Can Call Without Parentheses
What Is the Correct Format for a Blowfish Salt Using PHP's Crypt