1
我使用的Zend_View/Zend_Layout的範圍內,但我希望能夠追加劇本整體模板取決於控制器,所以控制器內我可以這樣做:從腳本添加到整體佈局控制器
public function someAction()
{
$something->headScript()->appendFile('script.js','text/javascript');
// etc etc
}
我已經啓用的Zend_View/Zend_Layout的是這樣的:
中的application.ini:
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
和bootstrap.php中:
protected function _initView()
{
$view = new Zend_View();
$view->doctype('XHTML1_STRICT');
$view->headTitle('zend layout tester');
// Add it to the ViewRenderer
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper(
'ViewRenderer'
);
$viewRenderer->setView($view);
// Return it, so that it can be stored by the bootstrap
return $view;
}
哈哈,的確如此。謝謝! – robjmills 2010-01-13 11:27:30