Re: [fw-general] FCKEditor and Zend_Form integration
Thanks for your help guys, i got it working just using the jquery (using the new 1.7 zendx jquery) to change all textarea's with class wysiwyg to fckeditor boxes, as sugested. Didn't use the plugin. easy peasy once pointed the right way. ta. -- View this message in context: http://www.nabble.com/FCKEditor-and-Zend_Form-integration-tp19688738p20671594.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] FCKEditor and Zend_Form integration
To follow up my initial post I also resorted to a simple jQuery bind noted here: http://www.fyneworks.com/jquery/FCKEditor/ This allows use of FCKEditor and maintains Zend Form validation etc. David drj201 wrote: > > 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-browser-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-tp19688738p20622010.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] FCKEditor and Zend_Form integration
On Fri, Nov 21, 2008 at 9:11 AM, Marko Korhonen <[EMAIL PROTECTED]> wrote: > > Hi, > > I use "class" attribute to "bind" FCKeditor to textarea fields. > > Example (I use ini files): > ; content element > form.elements.content.type = "textarea" > form.elements.content.options.required = true > form.elements.content.options.label = "Content" > form.elements.content.options.attribs.class = "editor" > > And in my global JavaScript (jQuery example): > > ta = $(".editor"); // find all textareas with editor class > >$.each(ta, function(i, textarea){ > >var oFCKeditor = new FCKeditor(textarea.name); > >oFCKeditor.BasePath = baseUrl +"js/fckeditor/"; >oFCKeditor.ToolbarSet = "Basic"; // Here you could make some > logic how to > set different toolbarset, maybe adding more classes to the textarea? > class="editor Default" > > // if ($(textarea).hasClass("Default")) oFCKeditor.ToolbarSet = "Default" > >oFCKeditor.ReplaceTextarea(); > >}) > > And of course I add fckeditor.js to my actions where I render forms. > > br, > Marko Just wanted to second Marko's solution since I did almost the same. Almost because I had a single text field and used an ID to bind fckeditor - $('#wysiwyg'). ;-) (The ID selector should be slightly faster in that case.) So far this seems to be the most clean integration between Zend_Form and fckeditor. No hacking necessary. :-) Till
Re: [fw-general] FCKEditor and Zend_Form integration
Hi, I use "class" attribute to "bind" FCKeditor to textarea fields. Example (I use ini files): ; content element form.elements.content.type = "textarea" form.elements.content.options.required = true form.elements.content.options.label = "Content" form.elements.content.options.attribs.class = "editor" And in my global JavaScript (jQuery example): ta = $(".editor"); // find all textareas with editor class $.each(ta, function(i, textarea){ var oFCKeditor = new FCKeditor(textarea.name); oFCKeditor.BasePath = baseUrl +"js/fckeditor/"; oFCKeditor.ToolbarSet = "Basic"; // Here you could make some logic how to set different toolbarset, maybe adding more classes to the textarea? class="editor Default" // if ($(textarea).hasClass("Default")) oFCKeditor.ToolbarSet = "Default" oFCKeditor.ReplaceTextarea(); }) And of course I add fckeditor.js to my actions where I render forms. br, Marko -- View this message in context: http://www.nabble.com/FCKEditor-and-Zend_Form-integration-tp19688738p20616806.html Sent from the Zend Framework mailing list archive at Nabble.com.
RE: [fw-general] FCKEditor and Zend_Form integration
These view helpers are great, thanks. Is it possible to apply them to form elements within your form classes , eg Forms_Cms extends Zend_Form so that zend_form populate and validate still works, but with the fckEditor functionality too? Will gammamatrix wrote: > > I created a view helper as well with the option of including extra > options: > -- View this message in context: http://www.nabble.com/FCKEditor-and-Zend_Form-integration-tp19688738p20615619.html Sent from the Zend Framework mailing list archive at Nabble.com.
RE: [fw-general] FCKEditor and Zend_Form integration
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 $optionsOptions */ 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 . ' $(function(){ > $(\'textarea#'.$id.'\').fck({path: \'/fckeditor/\', > toolbar:\'Toolbar_Name\', width:\'520px\', height:\'300px\'}); }); > '; > > } > > > > In a view : > > 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 > > http://www.internim.com/> http://www.internim.com > > > > -Message d'origine- > De : drj201 [mailto:[EMAIL PROTECTED] > Envoyé : vendredi 26 septembre 2008 15:42 > À : fw-general@lists.zend.com > 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.
RE: [fw-general] FCKEditor and Zend_Form integration
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 . ' $(function(){ $(\'textarea#'.$id.'\').fck({path: \'/fckeditor/\', toolbar:\'Toolbar_Name\', width:\'520px\', height:\'300px\'}); }); '; } In a view : 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 http://www.internim.com/> http://www.internim.com -Message d'origine- De : drj201 [mailto:[EMAIL PROTECTED] Envoyé : vendredi 26 septembre 2008 15:42 À : fw-general@lists.zend.com 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.