我正在尝试将kcfinder实现到CKEditor中,以便用户可以上传一些文件并将其实现到WYSIWYG编辑器中。我成功地管理了“在服务器上浏览”按钮,但是当我点击它时,弹出窗口会显示一些原始的PHP代码而不是het图像库:
- @copyright 2010-2014 KCFinder项目* @license http://opensource.org/licenses/GPL-3.0 GPLv3 * @license http://opensource.org/licenses/LGPL-3.0 LGPLv3 * @link http://kcfinder.sunhater.com * / require“core / bootstrap.php”; $浏览器 =“kcfinder \ browser”; //在较旧的$ browser = new $ browser()上执行core / bootstrap.php; // PHP版本(甚至是PHP 4) 浏览器的$>动作(); ?>
如何阻止它这样做?
我的文件树:
/coaster_cms/js/ckeditor-config.js
/coaster_cms/js/kcfinder/conf/config.php
加载脚本文件:
<script type="text/javascript" src="//code.jquery.com/jquery-2.2.1.min.js"></script>
<script type="text/javascript" src="//cdn.ckeditor.com/4.5.7/full/ckeditor.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/ckeditor/4.5.4/adapters/jquery.js"></script>
<script type="text/javascript" src="/coaster_cms/js/ckeditor-config.js"></script>
我的kcfinder config.js文件:
$_CONFIG = array(
// GENERAL SETTINGS
'disabled' => false,
'uploadURL' => "upload",
'uploadDir' => "",
'theme' => "default",
'types' => array(
// (F)CKEditor types
'files' => "",
'flash' => "swf",
'images' => "*img",
// TinyMCE types
'file' => "",
'media' => "swf flv avi mpg mpeg qt mov wmv asf rm",
'image' => "*img",
),
// IMAGE SETTINGS
// all image settings are the default ones
);
我的ckeditor-config.js文件:
$('textarea.ckeditor').ckeditor({
language: 'nl',
height: '400px',
// speciale karakters niet escapen
resize_enabled: false,
entities_latin: false,
entities_greek: false,
entities: false,
basicEntities: false,
// extra plugins
filebrowserBrowseUrl: 'http://development.kattenbelletjes.be/coaster_cms/js/kcfinder/browse.php?opener=ckeditor&type=files',
filebrowserImageBrowseUrl: 'http://development.kattenbelletjes.be/coaster_cms/js/kcfinder/browse.php?opener=ckeditor&type=images',
filebrowserFlashBrowseUrl: 'http://development.kattenbelletjes.be/coaster_cms/js/kcfinder/browse.php?opener=ckeditor&type=flash',
filebrowserUploadUrl: 'http://development.kattenbelletjes.be/coaster_cms/js/kcfinder/upload.php?opener=ckeditor&type=files',
filebrowserImageUploadUrl: 'http://development.kattenbelletjes.be/coaster_cms/js/kcfinder/upload.php?opener=ckeditor&type=images',
filebrowserFlashUploadUrl: 'http://development.kattenbelletjes.be/coaster_cms/js/kcfinder/upload.php?opener=ckeditor&type=flash'
});
我也尝试过:
$('textarea.ckeditor').ckeditor({
language: 'nl',
height: '400px',
// speciale karakters niet escapen
resize_enabled: false,
entities_latin: false,
entities_greek: false,
entities: false,
basicEntities: false,
// extra plugins
filebrowserBrowseUrl: 'D:/Websites/Kattenbelletjes/03 - Online/coaster_cms/js/kcfinder/browse.php?opener=ckeditor&type=files',
//filebrowserImageBrowseUrl: 'D:/Websites/Kattenbelletjes/03 - Online/coaster_cms/js/kcfinder/browse.php?opener=ckeditor&type=images',
filebrowserFlashBrowseUrl: 'D:/Websites/Kattenbelletjes/03 - Online/coaster_cms/js/kcfinder/browse.php?opener=ckeditor&type=flash',
filebrowserUploadUrl: 'D:/Websites/Kattenbelletjes/03 - Online/coaster_cms/js/kcfinder/upload.php?opener=ckeditor&type=files',
filebrowserImageUploadUrl: 'D:/Websites/Kattenbelletjes/03 - Online/coaster_cms/js/kcfinder/upload.php?opener=ckeditor&type=images',
filebrowserFlashUploadUrl: 'D:/Websites/Kattenbelletjes/03 - Online/coaster_cms/js/kcfinder/upload.php?opener=ckeditor&type=flash',
});
...但我发现力量不在我身边:我有一个空的弹出页面,没有任何错误。
有人可以帮我吗? ;)
修改
我仍在尝试修复它(首先在我的本地xampp服务器上;“http://development.kattenbelletjes.be”),但我还没有成功。我想问题出在ckeditor-config.js中的browse en upload url中。我的最新尝试:
filebrowserBrowseUrl: 'D:/Websites/Kattenbelletjes/03 - Online/app/webroot/coaster_cms/js/kcfinder/browse.php?opener=ckeditor&type=files',
filebrowserImageBrowseUrl: 'D:/Websites/Kattenbelletjes/03 - Online/app/webroot/coaster_cms/js/kcfinder/browse.php?opener=ckeditor&type=images',
filebrowserFlashBrowseUrl: 'D:/Websites/Kattenbelletjes/03 - Online/app/webroot/coaster_cms/js/kcfinder/browse.php?opener=ckeditor&type=flash',
filebrowserUploadUrl: 'D:/Websites/Kattenbelletjes/03 - Online/app/webroot/coaster_cms/js/kcfinder/upload.php?opener=ckeditor&type=files',
filebrowserImageUploadUrl: 'D:/Websites/Kattenbelletjes/03 - Online/app/webroot/coaster_cms/js/kcfinder/upload.php?opener=ckeditor&type=images',
filebrowserFlashUploadUrl: 'D:/Websites/Kattenbelletjes/03 - Online/app/webroot/coaster_cms/js/kcfinder/upload.php?opener=ckeditor&type=flash',
再次:我有空的弹出页面。当我检查Chromes F12控制台时,现在出现错误:
不允许加载本地资源: 文件:/// d:/Websites/Kattenbelletjes/03%20-%20Online/app/webroot/coaster_cms/js/kcfinder/browse.php开瓶器= CKEditor的&安培;类型=图片及的CKEditor = PostContent&安培; CKEditorFuncNum = 0&安培;中的langCode = NL
Aaaaaargh:)