FCKeditor implementation in ExpressionEngine

FCKeditor probably is the most flexible WYSIWYG editor. The way I implemented it is not the easiest way, but it works perfectly. This tutorial is for advanced php users, who understand what does each line mean, but beginners can simply copy php code listed below and edit two files.


Well, you have to edit two files. I uploaded my fckeditor in /system/modules dir. First file is fckeditor_php5.php (or fckeditor_php4.php, depending on php version installed on your server). We need to put all script executed contents into a variable (EE uses $r). By default script echoes contents, so we must replace echo command with return.

Find Create() method and replace it:

function Create()
// was
// echo $this->CreateHtml() ;
return $this->CreateHtml() ;

Then open cp.publish.php file in /system/cp directory. You must find line we are going to replace. In my EE 1.6.2 it was the 2747th line:

$r .= $DSP->input_textarea(’field_id_’.$row[’field_id’], $field_data, $rows, ‘textarea’, ‘100%’, $field_js, $convert_ascii, $text_direction);

Comment line listed above and add this code:

$oFCKeditor = new FCKeditor(’field_id_’.$row[’field_id’]) ;
$oFCKeditor->BasePath = ‘modules/fckeditor/’;
$oFCKeditor->Value = $field_data;
$r .= $oFCKeditor->Create();

You’ve got fckEditor working in your EE. Hope this tutorial was helpful :) May be later I will create plugin for EE, but now it is the easiest imnho way.

UPD: A problem with modules appeared. Since ExpressionEngine is trying to allocate language file for every module in “modules” directory you have to create empty “lang.fckeditor.php” file and put it in system/language/english dir

 Permalink Posted in Blogging,ExpressionEngine,Programming

Share: Digg it! Tech it! Delicious! StumbleUpon! Reddit! Magnolia! Facebook it! Google! Yahoo!
1 Ivan Blinkov | 02/12 00:02

...but the hardest for people who never seen any PHP sources…

2 John | 02/28 01:57

Great site and useful content!

3 arthur | 07/31 20:57

does this work in 1.6.3? I get a bunch of errors when trying to initialize FCK:

Notice: Use of undefined constant ’field_id’ - assumed ‘’field_id’’ in /home/shiftb/public_html/CC/cp/cp.publish.php on line 2749

4 Midgard | 09/12 13:22

You have to replace quotes ("’" with “‘“), because ExpressionEngine replaces it once the text is published here in the blog.

Page 1 of 1




Remember my personal information

Notify me of follow-up comments?

Submit the word you see below:

Next entry: Spring is coming

Previous entry: Reflections and Shadows