ZF2:无法为partial获取或创建实例

时间:2013-06-15 01:55:58

标签: zend-framework2 partial-views renderpartial partials

我试图在ZF2的布局中使用partials。

我尝试了几种方法(包括这里描述的方法,用户必须在模块配置中包含部分到路径)。每次我收到同样的错误。

例如,我遵循ZF2文档中的说明:http://framework.zend.com/manual/2.2/en/modules/zend.view.helpers.partial.html#zend-view-helpers-initial-partial

partials.phtml与layout.phtml位于同一文件夹中。服务器(我尝试了两者,apache和构建PHP服务器)引发了一个错误:

[Fri Jun 14 18:40:34 2013] 127.0.0.1:36616 [500]: / - Uncaught exception 'Zend\ServiceManager\Exception\ServiceNotFoundException' with message 
'Zend\View\HelperPluginManager::get was unable to fetch or create an instance for partial' in /var/www/frameworks/ZF2/library/Zend/ServiceManager/ServiceManager.php:496
Stack trace:
#0 /var/www/frameworks/ZF2/library/Zend/ServiceManager/AbstractPluginManager.php(103): Zend\ServiceManager\ServiceManager->get('partial', true)
#1 /var/www/frameworks/ZF2/library/Zend/View/Renderer/PhpRenderer.php(378): Zend\ServiceManager\AbstractPluginManager->get('partial', NULL)
#2 /var/www/frameworks/ZF2/library/Zend/View/Renderer/PhpRenderer.php(397): Zend\View\Renderer\PhpRenderer->plugin('partial')
#3 /var/www/html/zf2.tutorial/module/Application/view/layout/layout.phtml(129): Zend\View\Renderer\PhpRenderer->__call('partial', Array)
#4 /var/www/html/zf2.tutorial/module/Application/view/layout/layout.phtml(129): Zend\View\Renderer\PhpRenderer->partial('partial.phtml', Array)
#5 /var/www/frameworks/ZF2/library/Zend/View/Renderer/PhpRenderer. in /var/www/frameworks/ZF2/library/Zend/ServiceManager/ServiceManager.php on line 496

我正在使用PHP5.5.0RC3,ZF2.2.1和Apache 2.2.15

任何建议都将不胜感激。

0 个答案:

没有答案