Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Not an Issue
-
Affects Version/s: 1.10.0, 1.10.1, 1.10.2
-
Fix Version/s: 1.10.7
-
Component/s: Zend_Application, Zend_Application_Resource
-
Labels:None
Description
Snippet from my Bootstrap.php:
Inicializing navigation
[...]
protected function _initNavigation (){ $this->bootstrap('layout'); $layout = $this->getResource('layout'); $view = $layout->getView(); $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml', 'nav'); $container = new Zend_Navigation($config); $view->mainNavigation = $container; $view->navigation($container); }
[...]
Layout:
<?php echo $this->Doctype();?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<?php echo $this->headMeta();?>
<?php echo $this->headTitle();?>
<?php echo $this->headLink();?>
<?php echo $this->headStyle();?>
<?php echo $this->headScript();?>
<?php
echo $this->jQuery();
?>
</head>
<body>
<?php echo $this->layout()->content;?>
</body>
</html>
Application.ini:
resources.view.encoding = "UTF-8"
resources.view.doctype = "XHTML1_STRICT"
resources.view.helperPath.Alarm_View_Helper = "Alarm/View/Helper/"
resources.view.helperPath.Bcom_JQuery_View_Helper = "Bcom/JQuery/View/Helper/"
resources.view.helperPath.Bcom_View_Helper = "Bcom/View/Helper/"
resources.view.helperPath.ZendX_JQuery_View_Helper = "ZendX/JQuery/View/Helper"
With this configuration is throwed Zend_Plugin_Loader_Exception with message: Plugin by name 'JQuery' was not found in the registry; used paths: Zend_View_Helper_: Zend/View/Helper/:./views/helpers/
So layout have not bootstrap dependenci for view => layout is bootstraped before view
Posible solution:
1. before bootstrap layour resource in bootstrap must be boostraped layout - add call bootstrap method into my Bootrap.php.
Updated _initNavigation() from my bootstrap:
protected function _initNavigation (){ $this->bootstrap('view'); // <<<< THIS LINE $this->bootstrap('layout'); $layout = $this->getResource('layout'); $view = $layout->getView(); $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml', 'nav'); $container = new Zend_Navigation($config); $view->mainNavigation = $container; $view->navigation($container); }
2. add dependenci into layout bootstraping:
lestr@lestr-nb:~/projects/test/trunk/library$ svn diff Zend/Application/Resource/Layout.php
Index: Zend/Application/Resource/Layout.php
===================================================================
--- Zend/Application/Resource/Layout.php (revision 297)
+++ Zend/Application/Resource/Layout.php (working copy)
@@ -52,6 +52,7 @@
public function init()
{
$this->getBootstrap()->bootstrap('FrontController');
+ $this->getBootstrap()->bootstrap('View');
return $this->getLayout();
}
lestr@lestr-nb:~/projects/test/trunk/library$
Second solution is imho very better. Layout must be bootstraped after view in all time.
I don't see how this is an issue. the layout isn't dependent on the view. Also, the Navigation resource plugin that is shipped with Zend Framework bootstraps Zend_View, but only when it is dependent on it.