FCK editor is probably the best known WYSIWYG editor on the web. Although it’s retired now for the sake of CK editor, still it is being used by quite a number of developers for its simplicity and feature richness. Using FCK editor is very simple, but if you have a project in Codeigniter then to use FCK editor or CK editor you have to follow a different path which we will discuss in this tutorial step wise.

This tutorial assumes that you have a working codeigniter environment of version 2.0 or above and a PHP installation of version 5 or above.

Step-1:

Download the FCK editor from its web site http://ckeditor.com/download . Extract the fckeditor folder from the zip and place it under the third_party folder present inside the application folder. There is no strict rule where to put the fckeditor folder. So if you like you place it in any other folder or in a new folder you create. Wherever you put it, the location will be set in the configuration file so that it can be found by the system.

Step-2:

Now that the FCK Editor folder has been properly placed, lets create the config file for the FCK editor. This config file will hold the parameters that are required at the time of initializing an FCK editor object.  Inside the config folder under application create a new php file and name it fckeditor.php. The name should be in small letters. Just add the following code inside the file after the opening php tag:

Step-3:

From the fckeditor folder present inside the third_party folder copy the file named “fckeditor_php5” and place it inside libraries folder. Rename the file to “Fckeditor” and open it. Inside the file locate its constructor and just replace it with the following code:

Now we are all set to use FCKeditor.

Step-4:

In whatever place inside the view file you need fckeditor just call the create function as below:

For the above to work, inside your controller load the fckeditor library we just created and set the parameters as per your need.

In the same way you can also change the width, height and other settings of the editor and use it in your project.

Let me know any errata  and your views in the comments.