Reputation: 2500
Zend Framework v1.12
Tryed to init navigation in bootstrap and everything is fine, except appending it to view. Here is a code snippet:
protected function _initNavigation() {
$this->bootstrap('view');
$view = $this->getResource('view');
include_once 'views/navigation.php';
$nav = new Zend_Navigation($navigation);
$view->navigation($nav);
}
Error occures because of last line. Stacktrace:
Uncaught exception 'Zend_Controller_Router_Exception' with message 'Route archive is not defined' in C:\OpenServer\domains\zend.vortexed\library\Zend\Controller\Router\Rewrite.php:318
Stack trace: #0 C:\OpenServer\domains\zend.vortexed\library\Zend\Navigation\Page\Mvc.php(176): Zend_Controller_Router_Rewrite->getRoute('archive') #1
C:\OpenServer\domains\zend.vortexed\library\Zend\View\Helper\Navigation\HelperAbstract.php(686): Zend_Navigation_Page_Mvc->isActive(false) #2
C:\OpenServer\domains\zend.vortexed\library\Zend\View\Helper\Navigation\Menu.php(740): Zend_View_Helper_Navigation_HelperAbstract->findActive(Object(Zend_Navigation), 0, NULL) #3
C:\OpenServer\domains\zend.vortexed\library\Zend\View\Helper\Navigation\Menu.php(940): Zend_View_Helper_Navigation_Menu->_renderMenu(Object(Zend_Navigation), 'navigation', '', ' ', 0, NULL, false, false, NULL, false, 'active', 'menu-parent', false) #4
C:\OpenServer\domains\zend.vortexed\library\Zend\View\Helper\Navigation\Menu.php(1096): Zend_View_Helper_Navigation_Menu->renderMenu(NULL)
...
Dumping $nav
shows that it is good.
Also i tryed such variant:
protected function _initNavigation() {
$this->bootstrap('layout');
$layout= $this->getResource('layout');
$view= $layout->getView();
include_once 'views/navigation.php';
$nav = new Zend_Navigation($navigation);
$view->navigation($nav);
}
...same error
Upvotes: 0
Views: 270
Reputation: 1567
There are different reasons for that error,
Some of them are given in the following answer,
you can find it in here ROUTER EXCEPTION.
posting link as the answer, which helped The OP to get his answer, for the sake of marking the question as it has served it's purpose..
Upvotes: 1
Reputation: 884
This is not a view or layout error. The exception tell you that the route 'archive' is not define. Start by creating the 'archive' route.
Upvotes: 0