• View our reviews on Hot Scripts
  • JS Tutorial

Recent Comments

Powered by Disqus

Back to articles

CKEditor and CKFinder

There is one good combination for every CMS. One allows you to input and edit site content in very user friendly way without HTMl knowledge: And the other allows you to manage your files on server: But when you combine them together, you get a tool to manage your site content and add/edit pictures on the fly.

So how to implement CKFinder into CKEditor? When you downloaded both of them, first thing to do is to modify config.php file in your ckfinder folder. You need to modify CheckAuthentication function and $baseUrl and $baseDir variables to look like this:

function CheckAuthentication()
    // WARNING : DO NOT simply return "true". By doing so, you are allowing
    // "anyone" to upload and list the files in your server. You must implement
    // some kind of session validation here. Even something very simple as...

    // return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];

    // ... where $_SESSION['IsAuthorized'] is set to "true" as soon as the
    // user logs in your system.
    // To be able to use session variables don't forget to add session_start().
        return true;
        return false;

//your chosen folder with trailing slash
$baseUrl = '/uploads/';

$baseDir = resolveUrl($baseUrl);


Then to associate ckeditor with ckfinder and create instance where to addit your content:


include_once './ckeditor/ckeditor.php' ;
require_once './ckfinder/ckfinder.php' ;

//what should be inserted into textarea onload
$initialValue = "";

$ckeditor = new CKEditor( ) ;
$ckeditor->basePath = '/ckeditor/' ;

CKFinder::SetupCKEditor( $ckeditor, '/ckfinder/' ) ;

$ckeditor->editor("textarea_name", $initialValue);

And then all you need to do is to include both ckeditor.js and ckfinder.js in to your html document to make it work.

You may also be interested in:

Powered by

blog comments powered by Disqus