Recommended:

  • phpclasses.org
  • jsclasses.org
  • jsmag.com
  • siteapps.com
  • View our reviews on Hot Scripts
  • JS Tutorial
  • scripts.com
  • securesignup.com




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: http://ckeditor.com/. And the other allows you to manage your files on server: http://ckfinder.com/. 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:

<?php
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().
    session_start();
    if(isset($_SESSION['logged_in']))
    {
        return true;
    }
    else
    {
        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:

<?php

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 BlogAlike.com

blog comments powered by Disqus