Friday, 15 May 2015

How to include js and css in Zend Form Elements? -



How to include js and css in Zend Form Elements? -

i create own zend form element - app_form_element_wysiwyg

<?php class app_form_element_wysiwyg extends zend_form_element_xhtml { /** * default form view helper utilize rendering * @var string */ public $helper = 'wysiwyg'; }

then create helper wysiwyg - app_view_helper_wysiwyg

<?php class app_view_helper_wysiwyg extends zend_view_helper_formtextarea { public function wysiwyg($name, $value = null, $attribs = null) { // here want include js , css wysiwyg editor ... $xhtml = '<textarea name="' . $this->view->escape($name) . '"' . ' id="' . $this->view->escape($id) . '"' . $disabled . $this->_htmlattribs($attribs) . '>' . $this->view->escape($value) . '</textarea>'; homecoming $xhtml; } }

how can include js , css files wysiwyg editor?

the headscript() helper lets add together or manipulate script tags in header. within helper can do:

$this->view->headscript()->appendfile('/path/to/file.js');

then ensure layout calling helper somewhere in head section:

<?=$this->headscript()?>

to output html. there headstyle() helper works in similar way , can used css.

relevant docs:

headscript headstyle

zend-framework zend-form

No comments:

Post a Comment