phpcmsV9.5.8整合百度編輯器Ueditor1.4.3教程

來源:互聯網
上載者:User

標籤:style   blog   http   color   ar   os   java   for   sp   

最近在搞phpcms視頻功能,官方的視頻功能實在是坑,剛開始是想將優酷的上傳功能整合到ckeditor,在coding上有個項目,上傳已經整合好了,還沒有做上傳後視頻的擷取和顯示

項目地址:https://coding.net/savokiss/melos.git

這個項目是可以線上示範的,有興趣的同學可以私信我或者fork一下

今天偶然看到了百度的ueditor,看了一下有視頻上傳功能,可以滿足小規模視頻需求,所以就開始搞了,

網上看了很多教程有個別的缺點,不太適用於最新版v9,所以自己整理了一下:修改前注意備份

 

1. 下載Ueditor

官網:http://ueditor.baidu.com/website/download.html

 

2.解壓到phpcms目錄

將壓縮包內檔案夾改名為ueditor解壓到phpcms目錄下面的./statics/js/下,目錄結構如下:

 

3.修改ueditor/php/config.json

全域替換,

- 如果是本地項目,將/ueditor/php/upload/替換為/網站檔案夾/uploadfile/

- 如果是線上項目,將/ueditor/php/upload/替換為/uploadfile/

 

4.修改./libs/classes/form.class.php檔案

將靜態方法editor裡面所有內容替換為:

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

 

5.修改ueditor大小

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

找到/*UI工具列、編輯地區、底部*/下面的css:.edui-default .edui-editor,在其中添加:

width:auto!important;//用於ueditor工具列的寬度自適應

往下找到edui-editor-iframeholder,在其中也添加:

width:auto!important;//用於ueditor內容框寬度自適應

 

6.修改ueditor寬度

在ueditor/ueditor.config.js中,

找到initialFrameHeight,將此行注釋取消掉(預設的高度比較低)

 

 

 

 

 

注意:

1.如果需要自訂工具列:

修改ueditor/ueditor.config.js設定檔,

 ,toorbars : [[ ********** ]]

這個工具列表徵圖你可以參照官方文檔進行修改,去掉不需要的功能:http://fex.baidu.com/ueditor/#start-toolbar

 

2.附件沒有按照phpcms的命名規則修改,

如果需要修改,在config.json檔案中:

按如下替換:注意涉及到image,file,video,需要替換三次

uploadfile/{yyyy}/{mm}{dd}/{yyyy}{mm}{dd}{rand:6}

 

3.phpcms內建的ckeditor是上傳附件的時候是操作資料庫的,

所以後台附件管理有資料庫模式,而咱沒有寫相關代碼,所以如果需要管理附件只能用目錄模式進行刪除,這種情況下也就不需要注意路徑問題了

 

4.本方法是在新安裝的phpcms v9.5.8上面完成的,所以沒有考慮已有附件在ueditor中的顯示問題

如果是已存在的附件,需要替換如三個檔案中的一些路徑:

具體可以參考下帖對這三個檔案的操作部分:http://bbs.phpcms.cn/thread-882637-1-1.html

 

上述方法改過之後暫時沒有發現問題,如果有問題隨時更新,歡迎交流!

phpcmsV9.5.8整合百度編輯器Ueditor1.4.3教程

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.