请教关于CKEditor3.6.1的路径问题
发布于:2022-01-17 09:50:54
#1 prince
我在SP中的控制器放了代码:
import(APP_PATH.'/tpl/CKEditor/ckeditor.php');
$CKEditor = new CKEditor();
$CKeditor -> BasePath = 'tpl/ckeditor/';
$CKEditor->editor("editor1", "");
$this -> display('backtpl/article.html');
模板如下:
<{$eEditor1}>
运行后显示有textarea但没有工具栏,如图:

后查看CKEditor的js文件时发现所有js路径都成了这样:

路径前边多了站点目录名的最后一个字母,因为对JS不了解,所以只好来发帖求助了
2011-08-23 21:27:14
#2 jake
没遇过,之前配过ckeditor也没遇过这个问题,不过我之前配的参数不止一个BasePath。
2011-08-23 21:37:48
#3 prince
回复 2 jake 之前我直接在模板里填引用CKEditor的JS文件就能正常显示,但我看到论坛里之前的帖子说在SP里用FCKeditor,然后我就仿照着做发现这样的问题,继续请教……
2011-08-23 21:42:08
#4 prince
显示问题解决了,控制器代码应该如下:
import(APP_PATH.'/tpl/CKEditor/ckeditor.php');
$this -> CKEditor = new CKEditor();
$this -> CKEditor->basePath = '/tpl/CKEditor/';
$this -> CKEditor->editor("editor1", "");
$this -> display('backtpl/article.html');
模板如下:
<{$editor1}>
但存在一个问题,编辑器总是比其它HTML标签先输出:

文章标题&文章来源这个本应在编辑器上方的
2011-08-24 11:08:58
#5 prince
显示位置的问题解决了,谢谢2群里的各位朋友大力帮助,原因是$this -> diskplay('……');之前不有输出,否则$this -> diskplay('……');就会在已经输出的内容后面继续输出,所以导致位置不对,解决方法如下:
import(APP_PATH.'/tpl/CKEditor/ckeditor.php');
$this -> CKEditor = new CKEditor();
$this -> CKEditor->basePath = '/tpl/CKEditor/';
ob_start();//先缓冲CKEditor的输出
$editor1 = $this -> CKEditor->editor("editor1", "");
$this -> editor1 = ob_get_contents();//用这个函数捕获 CKEditor输出内容并保存到editor1传给模板
ob_end_clean();//清除并关闭缓冲
$this -> display('backtpl/article.html');
//
2011-08-24 12:07:14
#6 jake
ckeditor有个函数可以返回输出的内容的。和ob_get_contents();效果一样
2011-08-24 12:10:52
#7 Clear
配置路径的ckeditor的时候,遇到这样一个问题:
点击图片浏览服务器的时候,会把index.php这个放在路径里面,导致了url的错误:
路径如下:
http://localhost/speedphp/index.php/resoures/ckeditor/ckfinder/ckfinder.html?CKEditor=content&CKEditorFuncNum=2&langCode=zh-cn resources为ckeditor的放置文件夹.
2012-07-02 14:20:55
#8 jake
Clear 发表于 2012-7-2 14:20 
配置路径的ckeditor的时候,遇到这样一个问题:
点击图片浏览服务器的时候,会把index.php这个放在路径 ...
要先设置BasePath,而且一定要是绝对路径
2012-07-02 15:54:21
#9 Clear
jake 发表于 2012-7-2 15:54 
要先设置BasePath,而且一定要是绝对路径
我已经配置成功了。
谢谢jake.....
2012-07-04 17:28:25