How to use zend based tinymce?

I need to use Tinymce in my zend based project, but I don't know how to use it! can anyone help and give an example?

thanks

+4
source share
5 answers

There is some discussion and implementation here

+6
source

There are many examples on the TinyMCE website . To simplify the implementation with the Zend Framework and your templates, you can write a view helper.

+3
source

Well, load the library somewhere in your shared folder, and then into the controller action do:

$this->view->headScript()->appendFile('/some/path/tiny_mce.js'); $this->view->headScript()->appendFile('/some/path/tiny_mce-init.js'); 

Where the tiny_mce-init.js file might look something like this:

 tinyMCE.init({ theme : "advanced", mode : "textareas", // styles of the WYSIWYG content content_css : "/css/tiny_mce.css", }); 

This will turn all text fields into WYSIWYG editors.

+1
source

In the following code, I created Decorator, which I can use with text fields to show the WMD editor (the one used here). https://phpancake.svn.sourceforge.net/svnroot/phpancake/library/lib/decorator/Wmd.php

And in this code, I just expanded the text area to automatically use the decorator on top. https://phpancake.svn.sourceforge.net/svnroot/phpancake/library/lib/form/element/WmdTextArea.php

You can take this and replace with a tinymce mark-up.
and in code:

 $Form=new Zend_Form(....); $Form->addElement(new lib_form_element_WmdTextArea('my_name'...other text area params); 
+1
source

very similar to Richard Knop's answer I know, but I found that it would only work like this for some reason, otherwise the editor was always wrapped around the wrong element:

 $this->view->headScript()->appendFile("/scripts/vendor/tiny_mce/tiny_mce.js","text/javascript") ->appendFile("/scripts/addtinymce.js","text/javascript"); 

and in addtinymce.js:

 tinyMCE.init({ mode : "exact", elements : "yourcontent", theme : "simple" }); 
+1
source

Source: https://habr.com/ru/post/1301412/


All Articles