我想將jQuery加載到現有項目中,我相信ZendX存在於庫項目中的extras/library中。無法將jQuery加載到Zend框架項目
我添加以下兩行的application.ini
resources.view.helperPath.ZendX_JQuery_View_Helper = "ZendX/JQuery/View/Helper"
pluginPaths.ZendX_Application_Resource = "ZendX/Application/Resource"
然後在引導文件我添加此方法
protected function _initViewHelpers() {
$view = $this->getResource('view');
$view->addHelperPath("ZendX/JQuery/View/Helper", "ZendX_JQuery_View_Helper");
$view->jQuery()->addStylesheet('/css/ui-lightness/jquery-ui-1.8.18.custom.css')
->setLocalPath('/js/jquery-1.7.1.min')
->setUiLocalPath('/js/jquery-ui-1.8.18.custom.min.js');
}
,我從jQuery和CSS文件的路徑肯定。 並在layout.phtml我加入這一行
echo $this->jQuery;
,但這個錯誤occor
Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception' with message 'Plugin by name 'JQuery' was not found in the registry;
used paths: ZendX_JQuery_View_Helper_: ZendX/JQuery/View/Helper/ Zend_View_Helper_: Zend/View/Helper/' in E:\GCC\ZendFramework-1.11.11\library\Zend\Loader\PluginLoader.php:412
Stack trace: #0 E:\GCC\ZendFramework-1.11.11\library\Zend\View\Abstract.php(1182): Zend_Loader_PluginLoader->load('JQuery')
#1 E:\GCC\ZendFramework-1.11.11\library\Zend\View\Abstract.php(618): Zend_View_Abstract->_getPlugin('helper', 'jQuery')
#2 E:\GCC\ZendFramework-1.11.11\library\Zend\View\Abstract.php(344): Zend_View_Abstract->getHelper('jQuery')
#3 [internal function]: Zend_View_Abstract->__call('jQuery', Array)
#4 C:\AppServ\www\zendApps\inspection\application\Bootstrap.php(38): Zend_View->jQuery()
#5 E:\GCC\ZendFramework-1.11.11\library\Zend\Application\Bootstrap\BootstrapAbstract.php(669): Bootstrap->_initViewHelpers()
#6 E:\GCC\ZendFramework-1.11.11\library\Zend\Application\Bootstrap\BootstrapAbstract.php in E:\GCC\ZendFramework-1.11.11\library\Zend\Loader\PluginLoader.php on line 412
你解決了你的問題嗎? – Liyali 2012-04-04 05:04:50