CodeIgniter Forums

Full Version: Installing Ckeditor
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm a newbie to CodeIgniter and I'm trying to install Ckeditor in my app. I need step by step instructions for that. Any ideas where I can find that?
(08-16-2019, 09:13 PM)ronniebel Wrote: [ -> ]I'm a newbie to CodeIgniter and I'm trying to install Ckeditor in my app. I need step by step instructions for that. Any ideas where I can find that?

Use this guide link http://www.webpreparations.com/how-to-in...bootstrap/
it's quite simple, look here:
https://github.com/websiteinfo/CodeIgnit...it.php#L15
in form add id="editor1" in textarea (line 15)
and
https://github.com/websiteinfo/CodeIgnit...er.php#L34
in footer script ckeditor (line 34-37)
(08-17-2019, 12:10 AM)Avega Soft Wrote: [ -> ]
(08-16-2019, 09:13 PM)ronniebel Wrote: [ -> ]I'm a newbie to CodeIgniter and I'm trying to install Ckeditor in my app. I need step by step instructions for that. Any ideas where I can find that?

Use this guide link http://www.webpreparations.com/how-to-in...bootstrap/

Thank you very much. This guide is good and I followed every step, but for some reason, the page is not loading. Any ideas?

https://spokaneesl.com/ckeditor/ckeditor.php[url=https://spokaneesl.com/ckeditorckeditor.php][/url]
(08-17-2019, 08:20 PM)ronniebel Wrote: [ -> ]
(08-17-2019, 12:10 AM)Avega Soft Wrote: [ -> ]
(08-16-2019, 09:13 PM)ronniebel Wrote: [ -> ]I'm a newbie to CodeIgniter and I'm trying to install Ckeditor in my app. I need step by step instructions for that. Any ideas where I can find that?

Use this guide link http://www.webpreparations.com/how-to-in...bootstrap/

Thank you very much. This guide is good and I followed every step, but for some reason, the page is not loading. Any ideas?

https://spokaneesl.com/ckeditor/ckeditor.php[url=https://spokaneesl.com/ckeditorckeditor.php][/url]

Check your app log-file and web-console browser
In CI, you never address php files directly. All url's must point to a controller and a method inside that controller (unless you need the index method).
The textarea that you want to combine with CKEditor must be in a view.
You load the view in a controller.

Example:
View is (...)\application\views\test_ckeditor.php

Controller is (...)\application\controllers\Editor.php
(Keep in mind that a controller must have a name that starts with a capital letter).
PHP Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class 
Editor extends CI_Controller
{
 
 function test()
 
 {
 
    $this->load->view('test_ckeditor');
 
 }


Now, the url is https://spokaneesl.com/editor/test
This will show you the page with the CKEditor textarea. The "editor" segment in the url is the controller; the "test" segment is the method (= function) inside the controller.
Classic editor with default styles:

Code:
<html lang="en">

<head>
 <meta charset="utf-8">
 <meta name="robots" content="noindex, nofollow">
 <title>Classic editor with default styles</title>
 <script src="https://cdn.ckeditor.com/4.12.1/standard-all/ckeditor.js"></script>
</head>

<body>
 <textarea cols="80" id="editor1" name="editor1" rows="10" data-sample-short>&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href=&quot;https://ckeditor.com/&quot;&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
 <script>
   CKEDITOR.replace('editor1', {
     height: 260,
     width: 700,
   });
 </script>
</body>

</html>

Classic editor with custom styles:

Code:
<html lang="en">

<head>
 <meta charset="utf-8">
 <meta name="robots" content="noindex, nofollow">
 <title>Classic editor with custom styles</title>
 <script src="https://cdn.ckeditor.com/4.12.1/standard-all/ckeditor.js"></script>
</head>

<body>
 <textarea cols="80" id="editor2" name="editor2" rows="10" data-sample-short>&lt;p&gt;This is some &lt;strong&gt;sample text&lt;/strong&gt;. You are using &lt;a href=&quot;https://ckeditor.com/&quot;&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;</textarea>
 <script>
   CKEDITOR.replace('editor2', {
     height: 260,
     /* Default CKEditor styles are included as well to avoid copying default styles. */
     contentsCss: [
       'http://cdn.ckeditor.com/4.12.1/full-all/contents.css',
       'https://ckeditor.com/docs/vendors/4.12.1/ckeditor/assets/css/classic.css'
     ]
   });
 </script>
</body>

</html>
Thanks for all your support with this. It was my mistake. The controller from the tutorial was not loading properly because of my routing. That's fixed now and it works.