3
我有一个Zend_Dojo_Form,我已经从我的视图(它工作正常)移到我的布局,因为它是在每个页面上都有用的东西。然而,在布局中,表单不再有效 - 没有任何dijit元素出现,它的行为就像普通的HTML表单一样。Zend_Dojo_Form在布局
这里是我的自举的相关部分:
protected function _initView()
{
Zend_Layout::startMvc(array(
'layoutPath' => '../application/layouts',
'layout' => 'default'
));
$view = new Zend_View();
$view->setEncoding('UTF-8')
->doctype('HTML5');
// init Dojo
Zend_Dojo::enableView($view);
$view->dojo()->enable()
->setCdnVersion('1.5')
->requireModule('dojo.data.ItemFileWriteStore')
[...]
->addStyleSheetModule('dijit.themes.tundra');
// assign the view to the viewRenderer, so it will be used by the MVC actions
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view);
return $view;
}
没有任何错误(JS或ZF),形式是行不通的,因为它应该。
我假设我需要Dojo以某种方式启用布局视图。我尝试将上面的引导方法的布局部分更改为:
$layout = Zend_Layout::startMvc(array(
'layoutPath' => '../application/layouts',
'layout' => 'default'
));
$view = $layout->getView();
Zend_Dojo::enableView($view);
$layout->setView($view);
但是没有任何区别。
我发现this question这听起来与我的问题非常相似,但接受的答案只是显示了包括布局中的dojo helper,我已经在做。