Add scripts to overall layout from within a controller

aaghoasten

New Member
I'm using Zend_view/Zend_Layout but i want to be able to append scripts to the overall template depending on the controller, so within the controller i could do something like:\[code\]public function someAction(){ $something->headScript()->appendFile('script.js','text/javascript'); // etc etc}\[/code\]I have enabled Zend_view/Zend_Layout like this:in application.ini:\[code\]resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"\[/code\]and in Bootstrap.php:\[code\]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;}\[/code\]
 
Back
Top