I have seen many programmers asked a question about “How to use CKEditor?”. Well, here comes the very simple and effective solution. Before diving into the actual question, I would like to introduce about CKeditor. So, What is a CKeditor? The answer is, CKEditor is a ready-for-use HTML text editor designed to simplify web content creation. It’s a WYSIWYG editor that brings common word processor features directly to your web pages. So, using this editor, we can implement “What You See Is What You Get”.
As we have seen many word processor features like bold, link, fonts, codes, format, styles, special character, table, images, blah blah blah. We can find such features in CKeditor. Because CKEditor has an active community that openly develops and shares add-ons, which you are welcome to take part in. Open Source applications are totally free! They do not include adware or limited trial periods and can be used in commercial projects. More information about the CKeditor can be found in this link.
Steps to integrate CKeditor
Now, I will explain the process of using CKeditor. Don’t be scared. It’s more simple as you might have thought. To simplify the integration process, I have explained in different steps. So, I would recommend you to follow the below steps.
First, download the CKeditor plugin. As it is open source, it is free of cost. You can download it from its official website. Click Here to download the CKeditor Plugin. There are 3 packages of CKeditor i.e. Basic Package, Standard Package and Full Package.
After you have downloaded the CKeditor after selecting the package, you need to copy it to the root folder of your application. You can copy anywhere in your project, but simply copy in root folder make easy to import files.
As I have no index file, I will create a new index.html file in root directory of my project. This is where my CKeditor container will be placed. This is my sample of the index.html file. As I have no other codes than placing a textarea inside a form. You can create of your own.
<title>Using CKeditor example</title>
<form action = "control.php" method="post">
<textarea rows="40" class="ckeditor" name="ck_input" id="editor"></textarea>
<button type="submit" value="submit">submit</button>
This is the main section on how to use CKeditor. At first, you need to find ckeditor.js and sample.js file from the unzipped folder. Then you need to import in you index.html file.
After importing these 2 files, you need to create a textarea inside a form. You should note that the class of textarea should be “ckeditor” otherwise it will not work. I have given form action which is called after I clicked on submit button.
I have just echo my values of CKeditor in my control.php file.
Now, when you run the index.html file, you will see the CKeditor plugin integrated on your project. Wow!!! See, how simple it is. Now, you can add any text or image and change styles and format using CKeditor features. And, finally if you click on the submit button, it will output you what you have just inserted.
So, using these simple steps, you can integrate CKeditor with your project. Hope this helps you.