Welcome Guest, Not a member yet? Register   Sign In
CKEditor for CodeIgniter?
#1

[eluser]Unknown[/eluser]
Hi,
Is it possible to integrate CKEditor with CodeIgniter?
I read http://codeigniter.com/wiki/CKEditor but did not get what I want.
Thanks and greetings from Bulgaria!
#2

[eluser]Rolly1971[/eluser]
in a simple answer: Yes you can. Easily.

I use CKEditor Exclusively in my CI development ,well in all my web development where a web based html editor is required.

the only complaint i have is that integrating it into a Pure HTML5 Page it can get finicky with the css and layouts that use the css float rules. I got around this though by increasing the rows attribute of the base textarea until it looked right.

---

all you have to do really is (this is what i did) create a view that contains all the embedded javascript and script tags needed to run and convert textarea's into CKEditor blocks and passing that view the content you want loaded into the editor.
#3

[eluser]Unknown[/eluser]
Thanks but I did everything the tutorial and I just showed a blank page.
Can you help me set it up so that it works without a problem.
#4

[eluser]Unknown[/eluser]
^ Did you ever get this solved?

It would be appreciated if anyone could post working Helper/Controller/View files that are compatible with CodeIgniter v2.1.0. The above tutorial is several years old and I don't believe work without some modification.

I spent all day trying to debug the ckediter_helper.php and ckeditor.php files and get it working. The problem I appear to be having is $ckediter variable seems to be blank when passed to <?php echo display_ckeditor($ckeditor); ?>, even though $this->data['ckeditor'] appears to be initialized in the Controller.

Thanks for any assistance.

#5

[eluser]happycoder[/eluser]
Hopefully this is the same problem.
Using the latest version of CI, my ckeditor view loads from the views folder but all I get is the textarea. The script that follows is failing because of src= is not finding the ckeditor.js.

Ckeditor runs ok at the root of localhost. In the ci framework the script does not seem to work. The src= path is correct and it points to the file ckeditor.js. Looking at page source in Firebug the root version of ckeditor links to the file ckeditor.js. In my framework, the path is correctly defined, but if I click on the src link in Firebug I get the standard CI 404 page error.
Also, I'm using absolute path starting with base_url().'...' and not a relative path.

I'm new to Codeigniter so this may just be some newbie oversight or lack of understanding about Codeigniter fundamentals. The helpers - html, url and form are autoloaded. The ckeditor_helper provided in the tutorial is working fine. Controller and view seem to be working fine. I am using a template and I can eliminate the template if that will help.

In desperation I have tried AddType application/x-javascript *.js in .htaccess, tried adding var CKEDITOR_BASEPATH in the script with the correct base_url().'js/ckeditor' path. I'm using WAMP so there is no file or directory permission problem?

Why is Codeigniter giving a 404 error when the file and path are defined correctly?
#6

[eluser]CroNiX[/eluser]
Are you using an htaccess? What are the rules?
#7

[eluser]happycoder[/eluser]
Solved. Thanks CroNix you are right about .htaccess being the problem!
I found the answer in the post "How to Configure Ckeditor 3.61 with Codeigniter 2.03.

I deleted the .htaccess in ckeditor folder as suggested above. There is a .htaccess at the root of codeigniter. By mistake, I copied .htaccess from an example and the rewrite condition was did not match my file structure.

originally it said:
RewriteCond $1 !^(index\.php|images|css|scripts|robots\.txt)

All it needed was the correct path to js instead of scripts:
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt)

Little things make a big difference!
#8

[eluser]CroNiX[/eluser]
Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
I think this is a much better htaccess as it doesn't require ongoing maintenance like you just experienced. It basically says if the request isn't a real file and not a real directory (everything you were defining in your htaccess in the !^(index\.php|images|css|js|robots\.txt) line), then process it with CI. Otherwise process normally.

This will be the htaccess in the user guide when CI3 comes out.




Theme © iAndrew 2016 - Forum software by © MyBB