fckeditor in Codeigniter

1)Download Fckeditor.
2)Extract the folder “fckeditor” in “system/plugins/”
3)Open the “fckeditor” folder and copy the file “fckeditor.php”
4)Past the file in “system/application/libraries”
5)Edit the file you just past and add this line to the top
if (!defined('BASEPATH')) exit('No direct script access allowed');
6)In the same file now change the path of the include to have something like
if ( !function_exists('version_compare') || version_compare( phpversion(), '5', '<' ) )
    include_once( 'system/plugins/fckeditor/fckeditor_php4.php' ) ;
else
    include_once( 'system/plugins/fckeditor/fckeditor_php5.php' ) ;
7)Open the file “system/plugins/fckeditor/fckeditor_php5.php” and add this line to the top
if (!defined('BASEPATH')) exit('No direct script access allowed');
8)Change this part of the class
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() ;
    }
    ...
into this
class Fckeditor
{

    var $InstanceName ;
    var $BasePath ;
    var $Width ;
    var $Height ;
    var $ToolbarSet ;
    var $Value ;
    var $Config ;


    public function __construct( $array )
     {
        $this->InstanceName = $array['instanceName'] ;
        $this->BasePath        = $array['BasePath'] ;
        $this->Width        = $array['Width'] ;
        $this->Height        = $array['Height'] ;
        $this->ToolbarSet    = $array['ToolbarSet'] ;
        $this->Value        = $array['Value'] ;

        $this->Config        = array() ;
    }
    ...
8-bis) open the fckeditor_php4.php and add the same line to the top and rename the class name into “class Fckeditor”
9)In your controller you should have something like
function fckeditorform(){

   $fckeditorConfig = array(
          'instanceName' => 'content',
          'BasePath' => base_url().'system/plugins/fckeditor/',
          'ToolbarSet' => 'Basic',
          'Width' => '100%',
          'Height' => '200',
          'Value' => ''
            );
   $this->load->library('fckeditor', $fckeditorConfig);
   $this->load->view('fckeditorView');
        }function fckeditorshowpost(){

        echo $this->input->post('content');
        }
10)In your view you should have something like
$this->load->helper('form');
echo '<h1>FckEditor</h1>';
echo form_open('yourcontroller/fckeditorshowpost');

echo $this->fckeditor->Create() ;

echo form_submit(array('value'=>'submit'));
echo form_close();

Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

0 comments: on "fckeditor in Codeigniter"

:) ) ;) ) ;;) :D ;) :p :( ( :) :( :X =(( :-o :-/ :-* :| 8-} :) ] ~x( :-t b-( :-L x( =))
Post a Comment