Welcome Guest, Not a member yet? Register   Sign In
Fckeditor in CodeIgniter 1.7.1 in 10 steps
#1

[eluser]jongliko[/eluser]
I just figure out how to use Fckeditor as a Library in CI.

It's indeed simple but in the wiki ( http://codeigniter.com/wiki/FCKeditor/ ) it's hard to understand witch updates to do for the last CI version (1.7.1). I have seen in the forum that others have problems to understand, so I post a little step by step.

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
Code:
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
Code:
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
Code:
if (!defined('BASEPATH')) exit('No direct script access allowed');
8)Change this part of the class
Code:
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

Code:
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
Code:
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
Code:
$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();



Any problem use the wiki http://codeigniter.com/wiki/FCKeditor/ to complete my post

Hope this help ! ;-)


Messages In This Thread
Fckeditor in CodeIgniter 1.7.1 in 10 steps - by El Forum - 03-04-2009, 01:00 PM
Fckeditor in CodeIgniter 1.7.1 in 10 steps - by El Forum - 03-04-2009, 01:45 PM
Fckeditor in CodeIgniter 1.7.1 in 10 steps - by El Forum - 03-04-2009, 03:34 PM
Fckeditor in CodeIgniter 1.7.1 in 10 steps - by El Forum - 03-04-2009, 04:27 PM
Fckeditor in CodeIgniter 1.7.1 in 10 steps - by El Forum - 03-05-2009, 04:34 AM
Fckeditor in CodeIgniter 1.7.1 in 10 steps - by El Forum - 03-05-2009, 04:49 AM
Fckeditor in CodeIgniter 1.7.1 in 10 steps - by El Forum - 03-05-2009, 05:13 AM
Fckeditor in CodeIgniter 1.7.1 in 10 steps - by El Forum - 03-21-2009, 11:10 PM
Fckeditor in CodeIgniter 1.7.1 in 10 steps - by El Forum - 04-01-2009, 07:51 AM
Fckeditor in CodeIgniter 1.7.1 in 10 steps - by El Forum - 06-16-2009, 02:43 PM
Fckeditor in CodeIgniter 1.7.1 in 10 steps - by El Forum - 07-03-2009, 02:27 AM
Fckeditor in CodeIgniter 1.7.1 in 10 steps - by El Forum - 08-20-2009, 09:46 AM
Fckeditor in CodeIgniter 1.7.1 in 10 steps - by El Forum - 08-29-2009, 05:39 AM
Fckeditor in CodeIgniter 1.7.1 in 10 steps - by El Forum - 11-08-2009, 03:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB