Different Navigation Menus for Controller Views - Zend Framework

1.5k views Asked by At

I currently have 3 controllers, AdministratorController.php, ResellerController.php and ServiceProviderController.php.

Each of these have their own actions and views. For instance, AdministratorController.php has the views:

enter image description here

Each of these controllers' views will have exactly the same layout - the only difference in layout being different navigational menus.

So my question is, how I can configure different navigational menus for controllers, but using the same layout?

Many thanks

1

There are 1 answers

1
Akarun On BEST ANSWER

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