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,我已經在做。