zend form headscript
I have a Zend_Form which I reuse in different controllers. This form 开发者_如何转开发requires a javascript file.
How can I add a link to the javascript inside the form object?
From the view helper I can use headScript(), but inside the form?
Thanks.
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$view = $viewRenderer->getView();
$view->headScript();
anywhere :)
or ever simpler. Zend_Form
have method getView()
UPD: one more way :)
$view = Zend_Layout::getMvcInstance()->getView();
$view->headScript();
精彩评论