Hi James,

Code below just works, no need for events to attach.

Bart

      /*text field*/
        $fck = new SpaceCMS_Form_Element_Fck('text');
        $fck->setLabel('text');
        $this->addElement($fck);

/*class:*/
<?php
require_once(WEBROOT.'/fckeditor/fckeditor.php');
class SpaceCMS_Form_Element_Fck extends Zend_Form_Element_Textarea{
    /[EMAIL PROTECTED]: use a custom decorator instead of overriding render.
     * You will have to add some kind of prefix path in order to be able to set the decorator property
    */
   
    /**
     * Render form element
     *
     * @param  Zend_View_Interface $view
     * @return string
     */
    public function render(Zend_View_Interface $view = null)
    {
        if (null !== $view) {
            $this->setView($view);
        }
        $oFCKeditor = new FCKeditor($this->getName()) ;
        $oFCKeditor->BasePath = BASEURL.'/fckeditor/' ;
        $oFCKeditor->Height = 300;
        $oFCKeditor->Value        = $this->getValue();
        $content = $oFCKeditor->CreateHtml();
        $this->removeDecorator('ViewHelper');
        foreach ($this->getDecorators() as $decorator) {
            $decorator->setElement($this);
            $content = $decorator->render($content);
        }
        return $content;
    }   
}


james_fortune schreef:
Hello,

I am currently creating a cms. A text area on each page of the site will be
editable via fck editor however I am not sure how to put fck editor into a
form and save the content back to the database.

I have been trying to do this for a while now and am getting nowhere so
anyhelp would be greatly appreciated.

Thank You
  

--
Bart McLeod
Space Web Internet Team
Middenlaan 47
6865 VN Heveadorp
The Netherlands
t +31(0)26 3392952
m 06 51 51 89 71
@ [EMAIL PROTECTED]
www.spaceweb.nl
zce logo zce PHP 5 logo

Bart McLeod is a Zend Certified Engineer.

Click to verify!

Reply via email to