Migrating from FCKeditor to CKeditor without changing any code

Here’s a shim to allow you to swap FCKeditor for CKeditor without changing any application code. This is useful when you want to save time, or have other complications. e.g. When you migrate from Smarty 2 to Smarty 3, it seems that Smarty 3 is incompatible with FCKeditor. The quick solution is to drop in CKeditor.

This shim is for PHP. You’ll have to adapt it if you’re using a different language

To use this shim, simply unzip CKeditor into the directory where you unzipped FCKeditor. Remove all the contents of the “fckeditor” directory, and drop this in instead as fckeditor.php:


A shim to invoke CKEditor that saves us needing to rewrite the application

class FCKeditor


public $InstanceName ;

public $BasePath ;

public $Width ;

public $Height ;

public $ToolbarSet ;

public $Value ;

public $Config ;

public function __construct( $instanceName )


$this->InstanceName = $instanceName ;

$this->BasePath = ‘fckeditor/’ ;

$this->Width = ‘100%’ ;

$this->Height = ‘200’ ;

$this->ToolbarSet = ‘Default’ ;

$this->Value = ” ;

$this->Config = array() ;


public function Create()

global $fckshim_ckeditor_loaded;
if (!isset($fckshim_ckeditor_loaded)) {
echo ‘<script type=”text/javascript” src=”ckeditor/ckeditor.js”></script>’;
echo “<textarea id=\””.$this->InstanceName.”\” name=\””.$this->InstanceName.”\”>”.htmlspecialchars($this->Value).”</textarea>\n”;

echo “<script type=\”text/javascript\”>CKEDITOR.replace( ‘”.$this->InstanceName.”‘ );</script>\n”;




Print This Page Print This Page

2 Responses to Migrating from FCKeditor to CKeditor without changing any code

  1. Its working,

    Vidya Kiran.T

  2. This worked well, except that I had to exchange the double and single quotes from utf-8 to plain text, and I had to change this line:

    echo ‘’;


    echo ‘’;

    since you told us to put the contents of the zip into the fckeditor directory…..

    Other than that, it worked great. Thanks!

Leave a Reply