前面361源碼給大家介紹過了織夢dedeCMS更換編輯器的方法《織夢dedecms更換安裝百度編輯器教程》,同時(shí)我們也給大家介紹過《wordpress安裝百度編輯器(ueditor)圖文教程》,不少朋友在群里給361源碼留言:帝國cms默認(rèn)編輯器怎么更換成百度UEditor編輯器?
帝國cms已經(jīng)10多年了,但是他的內(nèi)置編輯器一直使用的很老的編輯器,現(xiàn)在很多功能都沒有,
而且現(xiàn)在的瀏覽器都不支持他內(nèi)置編輯器的一些功能了,但是我們又不能因?yàn)橐粋€(gè)編輯器來拋棄安全穩(wěn)定的帝國系統(tǒng),
所以我們就自己整合替換一個(gè)好用的,百度UEditor編輯器是一個(gè)開源免費(fèi)的編輯器,自己可以添加各種你想要的功能,大公司出的東西日后的版本也能有更新跟進(jìn)。
我們先看一眼UEditor編輯器的樣子吧
用過官網(wǎng)修改代碼的教程,失敗,再用一鍵包,圖片無法上傳,最后找到了正確的詳細(xì)教程,記錄如下:
百度編輯器UEditor下載地址:http://ueditor.baidu.com/website/download.html
在這個(gè)網(wǎng)頁中下載最新版本,防止漏洞。
下面開始:
下載UEditor PHP版本,這里以1.4.3.3為例,注意區(qū)分UTF-8和GBK的版本別弄錯(cuò)了。
下載后解壓,將文件夾名改為ueditor。
接著,上傳到服務(wù)器,帝國CMS文件夾e/data/ecmseditor/目錄下。
進(jìn)入帝國CMS后臺(tái),點(diǎn)擊頂部【系統(tǒng)】
再點(diǎn)擊左側(cè)【數(shù)據(jù)表與系統(tǒng)模型】>>>【管理數(shù)據(jù)表】
然后右側(cè)找到相應(yīng)的數(shù)據(jù)表,點(diǎn)擊【管理字段】
在彈出的新窗口內(nèi)找到字段名〖newstext〗,然后點(diǎn)擊此行的【修改】
找到〖輸入表單替換html代碼〗。
將里面的代碼全部刪除,復(fù)制下面的代碼到框內(nèi),然后點(diǎn)【提交】。
<script type="text/javascript" src="/e/data/ecmseditor/ueditor/ueditor.config.js"></script><script type="text/javascript" src="/e/data/ecmseditor/ueditor/ueditor.all.js"></script><script type="text/javascript" charset="utf-8" src="/e/data/ecmseditor/ueditor/lang/zh-cn/zh-cn.js"></script><link rel="stylesheet" href="/e/data/ecmseditor/ueditor/themes/default/ueditor.css"><script type="text/plain" id="myEditor" name="newstext" style="width:99%;height:450px;"> <?=$ecmsfirstpost==1?"":stripSlashes($r[newstext])?> </script><script type="text/javascript"> var editor = new baidu.editor.ui.Editor(); editor.render("myEditor"); editor.classid = <?=$classid?>; editor.filepass = <?=$filepass?>; </script><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#DBEAF5"><tr><td bgcolor="#FFFFFF"><input name="dokey" type="checkbox" value="1"<?=$r[dokey]==1?' checked':''?>>關(guān)鍵字替換 <input name="copyimg" type="checkbox" id="copyimg" value="1">遠(yuǎn)程保存圖片(<input name="mark" type="checkbox" id="mark" value="1"><a href="SetEnews.php" target="_blank">加水印</a>) <input name="copyflash" type="checkbox" id="copyflash" value="1">遠(yuǎn)程保存FLASH(地址前綴:<input name="qz_url" type="text" id="qz_url" size="">)</td></tr><tr><td bgcolor="#FFFFFF"><input name="repimgnexturl" type="checkbox" id="repimgnexturl" value="1">圖片鏈接轉(zhuǎn)為下一頁 <input name="autopage" type="checkbox" id="autopage" value="1">自動(dòng)分頁,每<input name="autosize" type="text" id="autosize" value="5000" size="5">個(gè)字節(jié)為一頁 取第<input name="getfirsttitlepic" type="text" id="getfirsttitlepic" value="" size="1">張上傳圖為標(biāo)題圖片(<input name="getfirsttitlespic" type="checkbox" id="getfirsttitlespic" value="1">縮略圖: 寬<input name="getfirsttitlespicw" type="text" id="getfirsttitlespicw" size="3" value="<?=$public_r[spicwidth]?>">*高<input name="getfirsttitlespich" type="text" id="getfirsttitlespich" size="3" value="<?=$public_r[spicheight]?>">)</td></tr></table>
這個(gè)代碼是UTF-8的編碼如果你的網(wǎng)站是GBK的修改代碼里的UTF-8就行了
如果需要修改編輯器的尺寸,在上面的代碼內(nèi)找到〖style="width:99%;height:450px;"〗進(jìn)行修改即可。
舉例:寬600像素,高500像素,則style="width:600px;height:500px;"
如果是自定義模型或改過模型,字段名不叫〖newstext〗的話,請把上面代碼里面所有的〖newstext〗改成你的字段名(一共兩處),否則會(huì)無法使用。
這樣一次修改,只能針對一張數(shù)據(jù)表,如果有多張數(shù)據(jù)表,請每個(gè)都要修改。
還有一點(diǎn)如果需要更換圖片上傳和以前一樣的路徑請修改/ueditor/php目錄下的config.json文件
里面每一條后面都有說明這里我就不用講了。
這個(gè)是帝國整合百度UEditor編輯器最簡單有效的方法主要的好處如下:
可以隨時(shí)跟著百度更新版本。網(wǎng)上很多人做的只能使用他修改過的文件無法升級。
可以隨時(shí)換會(huì)帝國本身的不需要修改什么文件。
對帝國cms版本沒有要求,cms升級對這也沒影響。
最后在附上帝國原始的替換前的代碼,方便有想換回去的同學(xué):
<?=ECMS_ShowEditorVar("newstext",$ecmsfirstpost==1?"":stripSlashes($r[newstext]),"Default","","300","100%")?><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#DBEAF5"> <tr> <td bgcolor="#FFFFFF"> <input name="dokey" type="checkbox" value="1"<?=$r[dokey]==1?' checked':''?>> 關(guān)鍵字替換 <input name="copyimg" type="checkbox" id="copyimg" value="1"> 遠(yuǎn)程保存圖片( <input name="mark" type="checkbox" id="mark" value="1"> <a href="SetEnews.php" target="_blank">加水印</a>) <input name="copyflash" type="checkbox" id="copyflash" value="1"> 遠(yuǎn)程保存FLASH(地址前綴: <input name="qz_url" type="text" id="qz_url" size=""> )</td> </tr> <tr> <td bgcolor="#FFFFFF"><input name="repimgnexturl" type="checkbox" id="repimgnexturl" value="1"> 圖片鏈接轉(zhuǎn)為下一頁 <input name="autopage" type="checkbox" id="autopage" value="1">自動(dòng)分頁 ,每 <input name="autosize" type="text" id="autosize" value="5000" size="5"> 個(gè)字節(jié)為一頁 取第 <input name="getfirsttitlepic" type="text" id="getfirsttitlepic" value="" size="1"> 張上傳圖為標(biāo)題圖片( <input name="getfirsttitlespic" type="checkbox" id="getfirsttitlespic" value="1"> 縮略圖: 寬 <input name="getfirsttitlespicw" type="text" id="getfirsttitlespicw" size="3" value="<?=$public_r[spicwidth]?>"> *高 <input name="getfirsttitlespich" type="text" id="getfirsttitlespich" size="3" value="<?=$public_r[spicheight]?>"> )</td> </tr> </table>
完成。
新聞熱點(diǎn)
疑難解答
圖片精選