【Ecshop】將內置的 FCkeditor 更換為 UEditor
阿新 • • 發佈:2017-08-27
php clu baidu tar conf ssi delet obj param
1.下載UE ,解壓到includes/,更名目錄名為ueditor
註意更改配置後端文件上傳路徑,參考文檔
2.修改admin/includes/lib_main.php,添加
1 /** 2 * 生成編輯器-UEditor 3 * @param string input_name 輸入框名稱 4 * @param string input_value 輸入框值 5 * @param string width 輸入框寬度 6 * @param string height 輸入框高度 7 */ 8 function create_ue_editor($input_name, $input_value = ‘‘,$width=‘100%‘,$height=‘320‘) 9 { 10 global $smarty; 11 12 $input_value = str_replace(["\r","‘"],["\\\r","\""],$input_value); 13 14 $ueditor=‘<!-- 加載編輯器的容器 --> 15 <input type="hidden" name="‘.$input_name.‘" id="editorcontent" value=""/> 16 <script id="‘.$input_name.‘" type="text/plain"></script> 17 <!-- 配置文件 --> 18 <script type="text/javascript" src="../includes/ueditor/ueditor.config.js"></script> 19 <!-- 編輯器源碼文件 --> 20 <script type="text/javascript" src="../includes/ueditor/ueditor.all.min.js"></script> 21 <!-- 實例化編輯器 -->22 <script type="text/javascript"> 23 var cnt=\‘‘.($input_value).‘\‘; 24 //去除異常項 25 delete(Object.prototype.toJSONString); 26 var ue = UE.getEditor(\‘‘.$input_name.‘\‘,{ 27 initialFrameWidth:\‘‘.$width.‘\‘, 28 initialFrameHeight:\‘‘.$height.‘\‘ 29 }); 30 //加載完成後填入內容 31 ue.ready(function() { 32 //設置編輯器的內容 33 ue.setContent(cnt); 34 }); 35 //內容更新到表單 36 ue.addListener("contentChange",function(){ 37 document.getElementById("editorcontent").value=ue.getContent(); 38 }); 39 </script>‘; 40 $smarty->assign(‘UEditor‘, $ueditor); 41 }
3.更改後臺所有獲取editor的代碼
create_html_editor(‘goods_desc‘, $goods[‘goods_desc‘]); //更改為 create_ue_editor(‘goods_desc‘, $goods[‘goods_desc‘]);
4.更改後臺模板所有顯示editor的代碼
{$FCKeditor} //更改為 {$UEditor}
【Ecshop】將內置的 FCkeditor 更換為 UEditor