【问题标题】:Customizing CKEditor to work with clear URL in framework自定义 CKEditor 以在框架中使用清晰的 URL
【发布时间】:2016-07-23 00:27:46
【问题描述】:

我写了一个URI结构为lang/domain/controller/method/id的小框架,现在我想使用与CKEditor集成的CKFinder由于地址结构而无法上传和浏览服务器?我该怎么办?浏览它使用的服务器:

http://localhost/public/admin/style1/plugins/ckfinder/ckfinder.html?CKEditor=abstraction&CKEditorFuncNum=1&langCode=fa

现在我已经通过这些更改了上传和浏览地址:

 CKEDITOR.replace('article',
    {
        filebrowserBrowseUrl : '/browser/browse.php',
        filebrowserUploadUrl : '/uploader/upload.php'
    });

它会显示图像,但是当我选择它们时,它不会将其带到页面上,它会将文件上传到我的图像文件夹,但无法添加它们,甚至无法在正文或上传对话框中预览它们。如何使用带有明确 URL 的 ckeditor?

【问题讨论】:

  • 我非常失望,任何建议表示赞赏

标签: javascript php url-rewriting ckeditor ckfinder


【解决方案1】:

带有自定义路径的CKFinder

如果您正在执行 URL 重写并且您希望 CKFinder 返回带有自定义路径的 URL,您可以执行以下操作:

您可以在 CKFinder 的 config.php 文件的 backends 部分中配置 CKFinder 如何将 URL 发送到 CKEditor:

$config['backends'][] = array(
    'name'         => 'default',
    'adapter'      => 'local',
    'baseUrl'      => 'http://base/url/ckfinder/will/give/to/ckeditor',
    'root'         => '/path/to/files/on/disk',
    'chmodFiles'   => 0777,
    'chmodFolders' => 0755,
    'filesystemEncoding' => 'UTF-8'
);

文件路径附加到所有 URL 中,此行为无法通过配置更改。

例如对于/path/to/files/on/disk/images/picture.png,返回的网址是http://base/url/ckfinder/will/give/to/ckeditor/images/picture.png

您也可以将'useProxyCommand' => true 添加到后端配置中。

这会将所有返回的 URL 更改为 http://localhost/core/connector/php/connector.php?command=Proxy&lang=en&type=Files&currentFolder=%2F&hash=9fd5e9f22b8dea6a&fileName=picture.png 的形式,其中 http://localhost/core/connector/php/connector.php 是用于发出请求以获取文件 URL 的 URL。

与文件管理器的自定义集成

如果您正在实现自己与文件管理器的集成,请检查您来自 /uploader/upload.php 的回复。 CKEditor 期望类似:

<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction(1, 'http://file/url', 'message');</script>`

您可以在CKEditor的documentation找到更多信息

【讨论】:

  • hi kfazithank you for your answer,但它不能解决我的问题?地址应该是什么?我不知道它必须是文件夹地址?浏览图像文件夹的文件?怎么样上传地址?你能帮我吗?
猜你喜欢
  • 2020-12-24
  • 1970-01-01
  • 2013-05-06
  • 1970-01-01
  • 1970-01-01
  • 2013-01-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多