Programmer's Reference Guide
| Zend_Navigation |
| Zend_Navigation |
Add A Comment
Please do not report issues via comments; use the ZF Issue Tracker.
If you have a JIRA/Crowd account, we suggest you login first before commenting.
| Zend_Navigation |
| Zend_Navigation |
Please do not report issues via comments; use the ZF Issue Tracker.
If you have a JIRA/Crowd account, we suggest you login first before commenting.
Comments
Copy and paste this (1.11)
/application/configs/navigation.xml
--------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<configdata>
<nav>
<home>
<label>Home</label>
<controller>index</controller>
<action>index</action>
</home>
<user>
<label>Users</label>
<controller>user</controller>
<action>index</action>
<pages>
<login>
<label>Login</label>
<controller>index</controller>
<action>index</action>
</login>
<register>
<label>Register</label>
<controller>register</controller>
<action>index</action>
</register>
</pages>
</user>
</nav>
</configdata>
/application/Bootstrap.php
-------------------------------------------------
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
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);
}
}
application/layouts/scripts/layout.phtml
---------------------------------------------------------
<!DOCTYPE html>
<html>
<head>
<?php echo $this->headTitle() ?>
<?php echo $this->headMeta() ?>
<?php echo $this->headScript() ?>
<?php echo $this->headStyle() ?>
</head>
<body>
<?php echo $this->navigation()->menu()->setMaxDepth(1); ?>
<?php echo $this->layout()->content; ?>
</body>
</html>
Bing, bang, boom. This is ALL anyone wanted to come here for.
You spoke from my soul.