简体   繁体   English

在CKEditor和basepath中的CKFinder集成?

[英]CKFinder integration in CKEditor and basepath?

I have the following integration CKEditor procedure: 我具有以下集成CKEditor程序:

window.onload = function(){
    var editor = CKEDITOR.replace( 'ckeditortextarea' );
    CKEDITOR.config.resize_enabled = false;
    CKFinder.setupCKEditor( editor, 'libraries/ckfinder/' );
};

I have my folders structured as such: 我的文件夹结构如下:

  • there is an WAMP alias named 'webx'. 有一个名为“ webx”的WAMP别名。
  • CKEDITOR: webx/mysite/libraries/ckeditor/ CKEDITOR:webx / mysite / libraries / ckeditor /
  • CKFINDER: webx/mysite/libraries/ckfinder/ CKFINDER:webx / mysite / libraries / ckfinder /
  • INDEX: webx/mysite/index.php 索引:webx / mysite / index.php

The integration procedure is within the 'head' tags. 集成过程位于“ head”标签内。 I have not changed any configuration files within the CK packages. 我没有更改CK软件包中的任何配置文件。 The problem is that the integration is not successful, the upload/browse not being available in CKEditor. 问题是集成不成功,上载/浏览在CKEditor中不可用。

My questions are: 我的问题是:

  1. What am I doing wrong? 我究竟做错了什么?
  2. What does basepath really represent? basepath真正代表什么?

The basepath should have been set '../ckfinder/' in order with my requirements. 基本路径应按照我的要求设置为“ ../ckfinder/”。 The browse/update sections appear now. 现在将显示“浏览/更新”部分。

The basepath is referenced from within the ckfinder directory. 基本路径是从ckfinder目录中引用的。 So either http://domain/.../ckfinder/ or ../ckfinder are correct. 因此, http://domain/.../ckfinder/../ckfinder都是正确的。

Try following steps. 请尝试以下步骤。 I got it by this way. 我是通过这种方式得到的。

1. Download CKEditor and CKFinder. 1.下载CKEditor和CKFinder。 Integrated code may be available on http://dwij.co.in/ckeditor-ckfinder-integration-using-php/ 集成代码可以在http://dwij.co.in/ckeditor-ckfinder-integration-using-php/获得
2. Put extracted code of both in one folder inside xampp as below. 2.如下所示将两者的提取代码放入xampp的一个文件夹中。 3. Create index file (index.html) which will be containing the editor as below code. 3.创建索引文件(index.html),它将包含以下代码的编辑器。

    <html>
    <head>
    <script type="text/javascript" src="ckeditor/ckeditor.js"></script>
    <script type="text/javascript" src="ckfinder/ckfinder.js"></script>
    </head>
    <body>
        <h1>CKEditor CKFinder Integration using PHP</h1>
        <textarea id="editor1" name="editor1" rows="10" cols="80"></textarea>
    <script type="text/javascript">
    var editor = CKEDITOR.replace( 'editor1', {
        filebrowserBrowseUrl : 'ckfinder/ckfinder.html',
        filebrowserImageBrowseUrl : 'ckfinder/ckfinder.html?type=Images',
        filebrowserFlashBrowseUrl : 'ckfinder/ckfinder.html?type=Flash',
        filebrowserUploadUrl : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
        filebrowserImageUploadUrl : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
        filebrowserFlashUploadUrl : 'ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
    });
    CKFinder.setupCKEditor( editor, '../' );
    </script>
    </body>
    </html>

so your folder structure will be something like this: 因此您的文件夹结构将如下所示:

htdocs
|_integrated
    |_ckeditor
    |   |_config.js
    |   |_...
    |_ckfinder
    |   |_config.php
    |   |_...
    |_uploads
    |_index.html
  1. Now open file config.php inside ckfinder & make following changes: 现在,在ckfinder中打开文件config.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']; return true; // not good option though; go for sessions } $baseUrl = 'http://localhost/integrated/uploads/'; $enabled = true; $config['SecureImageUploads'] = false; $config['ChmodFolders'] = 0777 ; 
  2. Now open url http://localhost/integrated/ and try uploading image. 现在打开url http://localhost/integrated/并尝试上传图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM