Skip to content
World Wide Web Server edited this page Jul 4, 2012 · 41 revisions

The following explains how to incorporate FCKeditor using Code Igniter's 1.4x Libraries.

Place your FCKeditor files in your CI base directory (in this example I've put the files under a folder called plugins).

Copy FCKeditor's PHP connector class (/FCKeditor/fckeditor.php) to your application's libraries folder (/system/application/libraries), edit 'fckeditor.php' and add the following line to the top:

[code] if (!defined('BASEPATH')) exit('No direct script access allowed'); [/code]

Now create an initialization file that corresponds to your FCKeditor PHP connector class. In your 'application/init' folder create a file called 'init_fckeditor.php' and add the following code:

[code] <?php if (!defined('BASEPATH')) exit('No direct script access allowed');

if ( ! class_exists('FCKeditor')) { require_once(APPPATH.'libraries/fckeditor'.EXT); }

$obj =& get_instance(); $obj->fckeditor = new FCKeditor('FCKEDITOR1'); $obj->ci_is_loaded[] = 'fckeditor'; ?> [/code]

The FCKeditor connector class should now be available in CI. Now simply load the library from your controller using:

[code] $this->load->library('fckeditor'); [/code]

And in your view file load the FCKeditor using the following:

[code] $this->fckeditor->BasePath = base_url() . '/plugins/fckeditor/'; $this->fckeditor->Value = 'This is some sample text. You are using FCKeditor.' ; $this->fckeditor->Create() ; [/code]

That's it! Hope this helps.

-Ralph The Seventh Letter

Clone this wiki locally