將FCKeditor加入Zend_Form

以下方式是使用fckeditor的ReplaceTextarea將fckeditor加入到zend_form中。

1.使用zend_form建立一個textarea
class Form extends Zend_Form

    public function __construct()
    {
        parent::__construct();
        $this->setName('form');
        $description=new Zend_Form_Element_Textarea('description');
        $description->setLabel('內容');

        $this->addElements(array($description));
    }
}

2.然後建立fckeditor,將textarea replace.
<script type="text/javascript" src="'/fckeditor/fckeditor.js"></script>
<script type="text/javascript">
    var editor = new FCKeditor('description') ;
    editor.BasePath = '/fckeditor/';
    editor.ReplaceTextarea() ;
</script>

沒有留言: