Welcome Guest, Not a member yet? Register   Sign In
Fckeditor installation
#1

[eluser]macleodjb[/eluser]
Has anyone implemented fckeditor with codeigniter? I tried using it on codeigniter and i can't quite seem to get it to work. I'm sure it's a path issue with the embedded console and the .htaccess file. It was working fine previously (before ci). So my first question is how to get it working.

Second question. With my migration to CI is it still worth having a rich text editor or can i do the same things with CI easier?
#2

[eluser]umefarooq[/eluser]
hi check this two posts it will help you alot

http://ellislab.com/forums/viewthread/95581/
http://ellislab.com/forums/viewthread/100073/

from second post you can load the library file.
#3

[eluser]macleodjb[/eluser]
I followed the wiki for CI 1.5 and i am getting an error on fckeditor.php file

"unexpected T_IF, expecting T_FUNCTION"

on this part of the file.

Code:
// PHP 4 Contructor
    function Fckeditor( $instanceName )
    {
        $this->__construct( $instanceName ) ;
    }

Here is what i've got.

in my system/libraries folder i have place the file Fckeditor.php

Code:
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');

class Fckeditor {
    var $InstanceName ;
    var $BasePath ;
    var $Width ;
    var $Height ;
    var $ToolbarSet ;
    var $Value ;
    var $Config ;

    // PHP 5 Constructor (by Marcus Bointon <[email protected]>)
    function __construct( $instanceName ){
        $this->InstanceName    = $instanceName ;
        $this->BasePath        = '/fckeditor/' ;
        $this->Width        = '100%' ;
        $this->Height        = '200' ;
        $this->ToolbarSet    = 'Default' ;
        $this->Value        = '' ;
        $this->Config        = array() ;
    }

// PHP 4 Contructor
    function Fckeditor( $instanceName )
    {
        $this->__construct( $instanceName ) ;
    }

if ( !function_exists('version_compare') || version_compare( phpversion(), '5', '<' ) )
    include_once( 'fckeditor_php4.php' ) ;
else
    include_once( 'fckeditor_php5.php' ) ;

    
}?&gt;

I have place the entire fckeditor folder here => "system/plugins/fckeditor/"

in my controller i am loading my library like this
Code:
$this->load->library('fckeditor','job_desc');

in my view file i have placed this code.
Code:
&lt;?php
$this->fckeditor->BasePath = 'system/plugins/FCKeditor/';
      $this->fckeditor->ToolbarSet = 'Default';
      echo $this->fckeditor->Create() ;
?&gt;

awaiting your response.. Thanks.
#4

[eluser]umefarooq[/eluser]
hi use this code hope you are using same as it is.

Code:
$this->load->library('fckeditor','content');
$this->fckeditor->BasePath = base_url().'system/plugins/fckeditor/';
$this->fckeditor->ToolbarSet = 'Default';
$this->fckeditor->Height = 300;
$data['content'] = $this->fckeditor->CreateHtml() ;

download the fckedior.zip you will find fckeditor.php put in library

Fckedior.php

and your file name in small letter no capitalize.
#5

[eluser]macleodjb[/eluser]
Ok i downloaded fckeditor.php and placed in my library, also copied your code into my view file. Which i'm not sure if it should go into the controller or not.

regardless...I am getting these errors.

Code:
A PHP Error was encountered

Severity: Warning

Message: Missing argument 1 for Fckeditor::__construct(), called in /home/user/public_html/example/system/libraries/Loader.php on line 931 and defined

Filename: libraries/fckeditor.php

Line Number: 18
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: instanceName

Filename: libraries/fckeditor.php

Line Number: 20
#6

[eluser]macleodjb[/eluser]
Ok i managed to get all my errors to go away, my iframe is loading but there is no data inside the iframe. It spread my div tags apart as if the form was there to type text but all you see is background. Any ideas? I'm out of ideas.

EDIT: Ok i've got fckeditor up and running my only question now is how to prepopulate the editor with either post string or database material.

I tried adding this line of code in my controller.

Code:
$this->fckeditor->value = $this->input->post('job_desc');

but i had no such luck. I did an echo for job_desc and it is indeed inside post['job_desc'] just for some reason it wont populate in my form.

EDIT #2: Ok i've got it now. I had a variable issue. I changed it like this and it works great.

Code:
$this->fckeditor->Value = $this->input->post('job_desc');
#7

[eluser]ray73864[/eluser]
I didn't bother with the fckeditor library for codeigniter, instead i have at the top of a page where i want to use it:

Code:
&lt;?php include_once "fckeditor/fckeditor.php"; ?&gt;

and then this further down:
Code:
&lt;?php
                $oFCKeditor = new FCKeditor('rte');
                $oFCKeditor->BasePath = '/fckeditor/';
                $oFCKeditor->ToolbarSet = 'Normal';
                $oFCKeditor->Config['ToolbarCanCollapse'] = false;
                $oFCKeditor->Create();
            ?&gt;

I downloaded my copy of fckeditor from their website and stuck it in the root directory in a folder called 'fckeditor' and then updated my .htaccess file to ignore all requests to the folder and treat it as not being a part of the website (like the img, css and js folders)
#8

[eluser]gh0st[/eluser]
Quote:updated my .htaccess file to ignore all requests to the folder and treat it as not being a part of the website (like the img, css and js folders)

Can you post that htaccess file commands to ignore requests to that folder?

Thanks
#9

[eluser]NZmuzzer[/eluser]
yes, anyone understand the .htaccess setup needed here?
#10

[eluser]macleodjb[/eluser]
i went with the direct approach and loaded the editor directly into my view. It works flawless now without periodic errors. I did however have to load the editor via the controller.




Theme © iAndrew 2016 - Forum software by © MyBB