Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module.php
- public function getServiceConfig()
- {
- return array(
- 'factories' => array(
- 'navigation' => 'ModuleNamespace\Navigation\Service\NavigationFactory',
- )
- );
- }
- ModuleNamespace\Navigation\Service\NavigationFactory
- <?php
- namespace ModuleNamespace\Navigation\Service;
- use Zend\ServiceManager\ServiceLocatorInterface;
- class NavigationFactory extends \Zend\Navigation\Service\DefaultNavigationFactory
- {
- public function createService(ServiceLocatorInterface $serviceLocator)
- {
- return new \ModuleNamespace\Model\Navigation();
- }
- }
- ModuleNamespace\Model;
- class Navigation extends \Zend\Navigation\Navigation
- {
- public function __construct()
- {
- $home = new \Zend\Navigation\Page\Mvc();
- $home->setLabel('Home')
- ->setController('index')
- ->setAction('index');
- $this->addPage($home);
- $contact = new \Zend\Navigation\Page\Mvc();
- $contact->setLabel('Contact')
- ->setController('contact')
- ->setAction('index');
- $this->addPage($contact);
- }
- }
- layout.phtml
- <?php echo $this->navigation('navigation')
- ->menu()
- ->setMaxDepth(0)
- ->setRenderInvisible(false) ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement