1. Place the FCKeditor directory in the ci_path/system/plugins/
2. Add in ci_path/system/application/config/config.php:
$config [' fckeditor_basepath '] = "/system/plugins/fckeditor/";
$config [' fckeditor_toolbarset_default '] = ' default ';
3, create helper, new form_helper.php in/system/application/helpers
Copy CodeThe code is as follows:
if (!defined (' BasePath ')) exit (' No Direct script access allowed ');
Include_once (BasePath. '/helpers/form_helper '. EXT);
function Form_fckeditor ($data = ", $value =", $extra = ")
{
$CI =& get_instance ();
$fckeditor _basepath = $CI->config->item (' Fckeditor_basepath ');
Require_once ($_server["Document_root"). $fckeditor _basepath. ' fckeditor.php ');
$instanceName = (Is_array ($data) && isset ($data [' name '])? $data [' name ']: $data;
$fckeditor = new FCKeditor ($instanceName);
if ($fckeditor->iscompatible ())
{
$fckeditor->value = Html_entity_decode ($value);
$fckeditor->basepath = $fckeditor _basepath;
if ($fckeditor _toolbarset = $CI->config->item (' Fckeditor_toolbarset_default '))
$fckeditor->toolbarset = $fckeditor _toolbarset;
if (Is_array ($data))
{
if (Isset ($data [' value ']))
$fckeditor->value = Html_entity_decode ($data [' Value ']);
if (Isset ($data [' BasePath ']))
$fckeditor->basepath = $data [' BasePath '];
if (Isset ($data [' ToolbarSet ']))
$fckeditor->toolbarset = $data [' ToolbarSet '];
if (Isset ($data [' width ']))
$fckeditor->width = $data [' Width '];
if (Isset ($data [' height ']))
$fckeditor->height = $data [' Height '];
}
return $fckeditor->createhtml ();
}
Else
{
Return Form_textarea ($data, $value, $extra);
}
}
?>
4, the use of FCKeditor in the project
Copy the Code code as follows:
$this->load->helper (' Form_helper ');
$data = Array (
' Name ' = ' newscontent ',
' id ' = ' newscontent ',
' ToolbarSet ' = ' advanced ',
' BasePath ' = $this->config->item (' Fckeditor_basepath '),
' Width ' = ' 80% ',
' Height ' = ' 200 '
);
echo Form_fckeditor ($data);
?>