I created a view helper as well with the option of including extra options:

class Site_View_Helper_FckEditor {

        /**
         * Creates a form element with FCKEditor.
         *
         * @param       string  $name                           The form 
element name
         * @param       string  $value                  The form element value
         * @param       array           $options                Options
        */
        public function fckEditor($name = '', $value = '', $options = array())
        {
                include_once(ROOT_PUBLIC . 
"/resources/fckeditor/fckeditor.php");

                $oFCKeditor = new FCKeditor($name);

                $oFCKeditor->Config['EnterMode'] = 
((isset($options['EnterMode'])) ?
$options['EnterMode'] : 'br');

                $oFCKeditor->ToolbarSet = ((isset($options['ToolbarSet'])) ?
$options['ToolbarSet'] : 'User');

                $oFCKeditor->BasePath = '/resources/fckeditor/';

                if(isset($options['Height']))           $oFCKeditor->Height = 
$options['Height'];
                if(isset($options['Width']))                    
$oFCKeditor->Width      = $options['Width'];

                $oFCKeditor->Value = $value;

                return $oFCKeditor->CreateHtml();
        }
}

This is a rough helper. I am sure there are other default options that may
need to be handled.


Guillaume BABIK wrote:
> 
> Hi,
> 
>  
> 
> In my projects using FCKEditor, I created a View's Helper that renders FCK
> Editor.
> 
>  
> 
> I just applied or not this helper on a Zend_Form_Element_Textarea to use
> FKCeditor.
> 
>  
> 
> My View's Helper is : 
> 
>     /**
> 
>           * Constructor
> 
>           *
> 
>           * @access public
> 
>           * @param string $xhtml balise textarea
> 
>           * @param string $id ID de la balise textarea
> 
>           * @return string 
> 
>           */
> 
>          public function TextareaFCK($xhtml, $id)
> 
>          {
> 
>         return $xhtml . '<script type="text/javascript"> $(function(){
> $(\'textarea#'.$id.'\').fck({path: \'/fckeditor/\',
> toolbar:\'Toolbar_Name\', width:\'520px\', height:\'300px\'}); });
> </script>';
> 
>          }        
> 
>  
> 
> In a view :
> 
> <?php echo $this->TextareaFCK($this->form->getElement('nameField'), '
> nameField '); ?>
> 
>  
> 
> I.E. : I use JQuery's FCKEditor version.
> 
>  
> 
> Hope it's help.
> 
>  
> 
> Regards,
> 
>  
> 
> Guillaume BABIK
> 
> INTERNIM
> 
> 45, rue Aristide Briand
> 
> 92300 LEVALLOIS
> 
>  <BLOCKED::http://www.internim.com/> http://www.internim.com
> 
>  
> 
> -----Message d'origine-----
> De : drj201 [mailto:[EMAIL PROTECTED] 
> Envoyé : vendredi 26 septembre 2008 15:42
> À : [email protected]
> Objet : [fw-general] FCKEditor and Zend_Form integration
> 
>  
> 
>  
> 
> Hi all,
> 
>  
> 
> I want to integrate FCKEditor (WYSIWYG) into a Zend_Form thus bringing all
> 
> the benefits that allows...
> 
>  
> 
> Note: Im not talking of simply getting FCKEditor to work in the view etc
> 
> (ala here:
> 
> http://blog.ekini.net/2007/11/28/using-fckeditor-with-zend-framework-file-br
> owser-enabled/#comments)
> 
> but actually integrating it into Zend_Form.
> 
>  
> 
> Has anyone done this before? What would be your recommended approach? Is
> it
> 
> even possible without  investing 100's of man hours and hacking the
> 
> framework to death? :-(
> 
>  
> 
> I first thought of simply dumping the HTML required by FCKEditor into a
> 
> decorator but this is not the answer.
> 
>  
> 
> I then thought of creating a new Zend_Form_Element and overwriting the
> 
> render method to simply return the HTML like so:
> 
>  
> 
>       public function render(Zend_View_Interface $view = null)
> 
>       {
> 
>                         
> 
>             $oFCKeditor = new FCKeditor_FCKeditor('FCKeditor1');
> 
>             $oFCKeditor->BasePath = '/js/FCKeditor/';
> 
>             $oFCKeditor->Value = $this->getValue();
> 
>                   
> 
>             return $oFCKeditor->CreateHtml();
> 
>             
> 
>       } 
> 
>  
> 
> Neither of the above provide any real integration with Zend_Form however!
> 
> Using the above method for example it is not possible to wrap the element
> in
> 
> Decorators or add a Label. It also doesnt provide integration when using
> 
> $form->getValues(). The FCKEditor form field only shows in $_POST.
> 
>  
> 
> Maybe a ViewScript Decorator is the answer? Wait for the Editor Dijit
> (even
> 
> though it is nowhere as comprehensive)?
> 
>  
> 
> What would you guys suggest?
> 
>  
> 
> Regards,
> 
>  
> 
> David
> 
> -- 
> 
> View this message in context:
> http://www.nabble.com/FCKEditor-and-Zend_Form-integration-tp19688738p1968873
> 8.html
> 
> Sent from the Zend Framework mailing list archive at Nabble.com.
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/FCKEditor-and-Zend_Form-integration-tp19688738p19689614.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to