PHPCMS v9.5.6整合UEditer1.4.2

來源:互聯網
上載者:User

標籤:c   style   class   blog   code   java   

-----------------------------------------------------------------------------------------------

首先去UEditor官網下載所需對應版本:http://ueditor.baidu.com/website/download.html

這裡以1.4.2 PHP 版本,UTF-8版 為例=>

[email protected] chenwei 整合 <www.chenwei.ws>-----------------------

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 = ‘<script type="text/javascript" src="‘.JS_PATH.‘ckeditor/ckeditor.js"></script>‘;    define(‘EDITOR_INIT‘, 1);}

  改為:  

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);}    $str .= "<script type=\"text/javascript\">\r\n";    $str .= "var editor = UE.getEditor(‘$textareaid‘);";    $str .= ‘</script>‘;

6. 在ueditor/themes/default/css/ueditor.css中,

  /*UI工具列,編輯地區,底部樣式*/ 裡

  增加一行: width:auto !important;   //註:增加此行,使編輯器自適應

 

7. 去編輯器下方除子標題顯示:去掉phpcms/libs/classes/form.class.php中 如下代碼,

$ext_str = "<div class=‘editor_bottom‘>";  if(!defined(‘IMAGES_INIT‘)) {  $ext_str .= ‘<script type="text/javascript" src="‘.JS_PATH.‘swfupload/swf2ckeditor.js"></script>‘;  define(‘IMAGES_INIT‘, 1);}  $ext_str .= "<div id=‘page_title_div‘>  <table cellpadding=‘0‘ cellspacing=‘1‘ border=‘0‘><tr><td class=‘title‘>".L(‘subtitle‘)."<span id=‘msg_page_title_value‘></span></td><td>  <a class=‘close‘ href=‘javascript:;‘ onclick=‘javascript:$(\"#page_title_div\").hide();‘><span>×</span></a></td>  <tr><td colspan=‘2‘><input name=‘page_title_value‘ id=‘page_title_value‘ class=‘input-text‘ value=‘‘ size=‘30‘>&nbsp;<input type=‘button‘ class=‘button‘ value=‘".L(‘submit‘)."‘ onclick=insert_page_title(\"$textareaid\",1)></td></tr>  </table></div>";  $ext_str .= "</div>";

8. 修改編輯器內的內容顯示不靠邊問題:

  statics/js/ueditor/themes/default/css/ueditor.css

  .edui-default .edui-editor-iframeholder {
    position: relative;
    width: auto !important; //新添加此行

 

9. 解決編輯器浮動在發布按鈕上方的問題:

  修改statics/css/zh-cn-system.css 下.fixed-bottom .fixed-but{}屬性,添加z-index: 2000;

------------------------------------------------------------------------------------------------

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.