Leoh
Leoh

Reputation: 670

Integrating a file browser into ckeditor & CakePHP

recently found an article in http://hashtwo.com/blog/integrating-a-file-browser-into-ckeditor-cakephp to integrate a file browser into ckeditor (file manager of core five labs )

I followed the steps but i get an error when I click the browse server button,

Missing Controller: Error: CkeditorController could not be found.

Upvotes: 0

Views: 3033

Answers (2)

AKKAweb
AKKAweb

Reputation: 3807

I had the same error at some point during my setup, but I don't seem to recall what was it and how I fixed it. Let me know if my next solution does not fix your problem and I will investigate a little more:

  1. First I followed the following tutorial which worked well, but missed the Authentication part: http://labs.corefive.com/projects/filemanager/
  2. Then I used the tutorial you referenced, except for the last section of code provided. Instead I added the following code directly to my view page: admin_add.ctp

    <?php echo $form->textarea('body', array(/*'class'=>'ckeditor', */'id' => 'body', 'class' => 'body')) ?>
    <?php
        include_once 'ckeditor/ckeditor.php' ;
        //require_once 'ckfinder/ckfinder.php' ;
        //$initialValue = 'Default value goes here' ;
        $ckeditor = new CKEditor() ;
        $ckeditor->basePath = '/ckeditor/' ;
        $ckeditor->config['filebrowserBrowseUrl'] = '/ckeditor/filemanager/index.html';
        $ckeditor->config['filebrowserUploadUrl'] = '/ckeditor/filemanager/connectors/php/filemanager.php';
        $ckeditor->config['filebrowserImageBrowseUrl'] = '/ckeditor/filemanager/index.html?type=Images';
        $ckeditor->config['filebrowserImageUploadUrl'] = '/ckeditor/filemanager/connectors/php/filemanager.php?command=QuickUpload&type;=Images';
    
        $ckeditor->config['filebrowserWindowWidth'] = '800';
        //CKFinder::SetupCKEditor( $ckeditor,'/ckfinder/' ) ;
    
                // This will replace CakePHP textarea listed above.
        $ckeditor->replace('body');
    ?>
    

Also, for the Auth Section of his tutorial I changed it to match my requirements:

function auth() {
    session_name("CAKEPHP");
    session_start();
    if(isset($_SESSION['Auth']['User']) )
    {
        //Since CKEditor for me is only used in the admin section
        //I make sure only admins can access it, group_id=1
        if($_SESSION['Auth']['User']['group_id'] == 1)
        {
            return true;
        }
    }
    return false;
}

Upvotes: 1

floriank
floriank

Reputation: 25698

If it tries to find a controller this means it can not access the editors file or folder and instead the dispatcher of CakePHP gets the request and tries to load a fckeditor controller.

This means you'll need to place the editor in the right directory (for example app/webroot/fckedtor/) or use the correct url to access it.

Upvotes: 1

Related Questions