Skip to main content

Cakephp 3x Add TinyMCE text editor in 2 Steps

Cakephp 3.x Add text editor in 2 Steps


In this tutorial we will use TinyMCE because its easy to implement TinyMCE text editor



Step 1


So First Add this js to your header or default layout or your preferred location where you call other js files

 <script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
  <script>
   tinymce.init({ selector:'.edittextarea', height: 500,  plugins: [
    'advlist autolink lists link print preview anchor',
    'visualblocks code fullscreen',
    'insertdatetime table contextmenu paste code'
   ], });
 </script>



 
Step 2
Now Add edittextarea class to textarea where you want to change textarea to text editor

Here is the example of how to create text editor textarea in Cakephp 3.x 

<?= $this->Form->input('description', array('type' => 'textarea','class' => 'edittextarea form-control','value'=>$description,'label' => 'Content :')); ?>


Now run your url and you will see a text editor instead of textarea . Simple :)

Related Links

How to use tinyMCE in cakephp 3.x
How to use tinyMCE to add text editor

Comments