phpcms自带富文本编辑器为ckeditor,功能不必多说,排版尤其不便;决定替换为百度ueditor。
这里phpcms版本为v9.5.9,ueditor版本为[1.4.3.3 php版本]——utf-8版。其余版本大致相同,具体替换步骤如下:(提示:修改文件前请做好备份)
一、下载ueditor:http://ueditor.baidu.com/website/download.html
二、解压到phpcms目录:
将压塑包内文件夹重命名为 ueditor,解压到phpcms目录下面的 ./statics/js/ 目录下:
三、修改ueditor文件夹中ueditor/php/config.json文件,全局替换:
(1)替换上传文件的路径,将 /ueditor/php/upload/… 替换为 /uploadfile/…;以上传图片为例,ueditor默认的图片上传路径设置为
phpcms中图片(附件)的路径及命名规则是 /uploadfile/年/月日/文件名,其中文件名的命名规则是 “年 月 日 时 分 秒 随机3位数字”,故这里替换imagepathformat的配置项为:
其余以下各个上传配置项的上传路径\\\’xxxxpathformat\\\’ 部分,均替换为:
“/uploadfile/{yyyy}/{mm}{dd}/{yyyy}{mm}{dd}{hh}{ii}{ss}{rand:3}”
(2)配置图片(附件)的访问路径前缀,这一步解决添加内容时,取第一张图片为缩略图的问题(缩略图不显示)。以上传图片为例,ueditor默认的图片访问路径前缀为空:
这里修改为你的网站平台的域名,可在本地建立虚拟站点,如域名为 http://www.xxx.com,则此处修改为:
该文件中其余各个有urlprefix(访问路径前缀)的地方,都配置为 http://www.xxx.com
(3)替换“列出指定目录“的路径,主要用于多图上传时的在线管理,和附件上传时的在线附件,原配置为:
这里 listpath,均替换为 /uploadfile/ :
四、修改 .libs/classes/form.class.php文件,将静态方法editor 的所有内容替换为:
public static function editor($textareaid = \\\’content\\\’, $toolbar = \\\’basic\\\’, $module = \\\’\\\’, $catid = \\\’\\\’, $color = \\\’\\\’, $allowupload = 0, $allowbrowser = 1,$alowuploadexts = \\\’\\\’,$height = 320,$disabled_page = 0, $allowuploadnum = \\\’10\\\’) { $str =\\\’\\\’; if(!defined(\\\’editor_init\\\’)) { $str .= \\\'<script type="text/javascript" src="\\\’.js_path.\\\’ueditor/ueditor.config.js"></script>\\\’; $str .= \\\'<script type="text/javascript" src="\\\’.js_path.\\\’ueditor/ueditor.all.js"></script>\\\’; $str .= \\\'<script type="text/javascript" src="\\\’.js_path.\\\’ueditor/ueditor.parse.js"></script>\\\’; $str .= \\\'<link rel="stylesheet" href="\\\’.js_path.\\\’ueditor/themes/default/css/ueditor.css"/>\\\’; define(\\\’editor_init\\\’, 1); } if($toolbar == \\\’basic\\\’) { $toolbar = "[\\\’fullscreen\\\’,"; $toolbar .= defined(\\\’in_admin\\\’) ? "\\\’source\\\’," : \\\’\\\’; $toolbar .= "\\\’|\\\’, \\\’bold\\\’, \\\’italic\\\’, \\\’link\\\’, \\\’unlink\\\’, \\\’|\\\’, \\\’insertorderedlist\\\’, \\\’insertunorderedlist\\\’, \\\’|\\\’, \\\’selectall\\\’, \\\’removeformat\\\’, \\\’formatmatch\\\’, \\\’cleardoc\\\’, \\\’|\\\’, \\\’searchreplace\\\’]rn"; } elseif($toolbar == \\\’full\\\’) { $toolbar = "[\\\’fullscreen\\\’,"; $toolbar .= defined(\\\’in_admin\\\’) ? "\\\’source\\\’," : \\\’\\\’; $toolbar .= "\\\’selectall\\\’, \\\’removeformat\\\’, \\\’formatmatch\\\’, \\\’autotypeset\\\’, \\\’cleardoc\\\’, \\\’pasteplain\\\’, \\\’|\\\’, \\\’undo\\\’, \\\’redo\\\’, \\\’|\\\’, \\\’indent\\\’,\\\’justifyleft\\\’, \\\’justifycenter\\\’, \\\’justifyright\\\’, \\\’justifyjustify\\\’, \\\’blockquote\\\’, \\\’|\\\’, \\\’insertorderedlist\\\’, \\\’insertunorderedlist\\\’, \\\’|\\\’, \\\’simpleupload\\\’, \\\’insertimage\\\’, ], [
恶意抢注域名违法吗 恶意抢注域名违反了哪些法律嘉兴网站制作时安装IIS时提示找不到zClientm.exe文件的问题应该如何解决域名去哪里注册比较好 四声母域名现在价格多少钱网站排行分类有哪些?影响网站排行的因素有哪些企业网站后台开发是如何操作的及网站前台和后台的区别选着一家好的高端网站建设公司非常重要IIS中如何导入ssl证书中级证书 不同等级SSL证书的区别域名注册海外的需要多少钱 海外域名注册需要实名么