欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

PHPCMS v9.5.6整合UEditer1.4.2_PHP教程

程序员文章站 2022-05-30 10:24:38
...
-----------------------------------------------------------------------------------------------

首先去UEditor官网下载所需对应版本:http://ueditor.baidu.com/website/download.html

这里以1.4.2 PHP 版本,UTF-8版 为例=>

------------------------------@ chenwei 整合 -----------------------

1. 将所下载的程序包解压,得到程序包目录,将程序包目录更名为ueditor。

2. 将ueditor包放入PHPCMS_PATH/statics/js/中。(PHPCMS_PATH为phpcms的入口文件所在路径)

3. 修改ueditor/php/config.json,将上传图片配置项路径,涂鸦图片上传配置项路径,截图工具上传保存路径,抓取远程图片保存路径,上传视频保存路径,上传文件保存路径 中: /ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6} 改为: /phpcms/uploadfile/{yyyy}/{mm}{dd}/{yyyy}{mm}{dd}{rand:6},符合PHPCMS的路径规则。

  指定要列出图片的目录 和 指定要列出文件的目录 为:/phpcms/uploadfile/

4. 修改ueditor/ueditor.config.js配置文件,

  1) 自定义工具栏内容: ,toorbars : [[ ********** ]]

  这个工具栏图标你可以参照官方文档进行修改,去掉不需要的功能:http://fex.baidu.com/ueditor/#start-toolbar

//工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的从新定义
   , toolbars: [[
           'fullscreen', 'source', '|', 'undo', 'redo', '|',
           'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
           'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
           'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
           'directionalityltr', 'directionalityrtl', 'indent', '|',
           'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
           'link', 'unlink','|',
           'simpleupload', 'insertimage', 'insertvideo', 'music', 'attachment', 'insertframe','pagebreak', 'template', 'background', '|',
           'horizontal', 'date', 'time', 'spechars', 'snapscreen', 'wordimage', '|',
           'inserttable', 'deletetable','preview', 'searchreplace', 'help', 'drafts'
     ]]

  2) 自定义编辑器宽高: ,initialFrameWidth:700   //初始化编辑器宽度,默认1000

             ,initialFrameHeight:350  //初始化编辑器高度,默认320

5. 修改PC_PATH/libs/classes/form.class.php文件,

  将原来的:

if(!defined('EDITOR_INIT')) {
    $str = '';
    define('EDITOR_INIT', 1);
}

  改为:  

if(!defined('EDITOR_INIT')) {
    $str .= '';
    $str .= '';
    $str .= '';
    $str .= '';
    define('EDITOR_INIT', 1);}
    $str .= "
相关标签: PHP