CKeditor/FCK Editor is one of the world’s best WYSIWYG editor. CKEditor provides built-in file management functions.
(If you need a simple Rich Text Editor, I suggest you to use TinyMCE instead of CKEditor)
If you want to integrate CKEditor to your CakePHP page, then follow the below steps.
Step 1 :
Download CK Editor
http://ckeditor.com/download
Step 2 :
Unzip it and save the ckeditor directory in app\webroot\js folder.
Step 3 :
Open your controller class and Add ‘Javascript’ to $helpers array.
So your helper variable may look something like this.
var $helpers = array(’Html’, ‘Form’, ‘Javascript’);
Step 4 :
Include the ckeditor js file in your view.
<?php $javascript->link(’/js/ckeditor/ckeditor’, false);?>
Step 5 :
Add a text area to your view and add the style class ‘ckeditor’ to text area.
echo $form->textarea(’txtEditor’, array(’class’=>’ckeditor’));
Done… Load the page…
Now you can see your FCK editor in your page.
RSS feed for comments on this post. TrackBack URL
November 6th, 2009 at 8:03 am
Many Thanks…….!
December 12th, 2009 at 9:34 pm
Thanks a lot…
January 9th, 2010 at 11:09 pm
Thanks very much. This is just what I needed.
January 13th, 2010 at 7:28 pm
Awesome, thanks!
March 4th, 2010 at 8:47 am
I have inserted Ckeditor 3.x in my page and i submit my form data (along with the text area)to the controller. I am trying to save data to Mysql database but not able to save. I wonder if this is a correct way of doing it.
Form name = Admin
Field name = content
Controller name = Admins
Modelname = Admin
$grn3 = $this->data['Admin']['content'] ;
$this->Session->setFlash($grn3);
$this->Admin->set($this->data ); //setting data to model
$this->Admin->saveField(’content’, $grn3); //saving single
field
Setflash method flashes the data content, but save is not working. I am not sure if this is the way of saving text editor data to database. Please show me how to save editor data to
datatbase.
Thankx
John M.
March 4th, 2010 at 10:09 am
Hi John M,
Adding a CKEditor to your page will not affect data saving in any way.
Suppose you have a View page like this.
echo $form->input(’title’);
echo $form->input(’description’);
Now only thing you are doing is to add a class to the existing input field.
echo $form->input(’title’);
echo $form->input(’description’, array(’class’=>’ckeditor’));
So try to add a class ‘ckeditor’ to an existing field.