3

帝国CMS7.5版本整合百度编辑器(UEditor)教程方法

 2 years ago
source link: https://www.huhexian.com/13695.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

帝国CMS7.5版本整合百度编辑器(UEditor)教程方法

2021-11-2614:19:18评论3046字

我们在使用帝国cms7.5版本会发现和之前版本的编辑一样的,这个编辑器功能少而且不美观,很多小伙伴都想着如何替换掉原来的编辑器,那么帝国CMS7.5版本如何整合百度编辑器(UEditor)呢?下面就来给大家带来帝国CMS7.5版本整合百度编辑器(UEditor)教程方法。

帝国CMS7.5版本整合百度编辑器(UEditor)教程方法

第一步:下载百度编辑器原版(PHP版),解压到帝国/e/extend/ueditor/目录下

第二步:使用本项目上controller.php action_crawler.php文件替换/e/extend/ueditor/php/目录下的controller.php action_crawler.php文件。

复制ueditor.toolbarconfig.js在/e/extend/ueditor/目录下

第三步:修改帝国CMS字段HTML,在编辑器字段增加处理和编辑器引入代码。

  1. <?php
  2. $ziduan = 'newstext'; //编辑器使用的字段名称
  3. if ($enews == 'MAddInfo' || $enews == 'MEditInfo') { //前台投稿
  4. $qiantai = 1;
  5. $ziduanzhi = $ecmsfirstpost == 1 ? "" : DoReqValue($mid, $ziduan, stripSlashes($r[$ziduan]));
  6. } else { //后台
  7. $qiantai = 0;
  8. $ziduanzhi = $ecmsfirstpost == 1 ? "" : stripSlashes($r[$ziduan]);
  9. ?>
  10. <script>var ClassId='<?=$classid?>',InfoId='<?=$id?>',FilePass='<?=$filepass?>',Ehash='<?=$ecms_hashur['ehref']?>',QianTai='<?=$qiantai?>';</script>
  11. <script type="text/javascript" charset="utf-8" src="/e/extend/ueditor/ueditor.config.js"></script>
  12. <script type="text/javascript" charset="utf-8" src="/e/extend/ueditor/ueditor.all.min.js"></script>
  13. <script type="text/javascript" charset="utf-8" src="/e/extend/ueditor/ueditor.toolbarconfig.js"></script>
  14. <textarea id="<?=$ziduan?>" name="<?=$ziduan?>"><?=$ziduanzhi?></textarea>
  15. <script type="text/javascript">
  16. <?=$ziduan?> = UE.getEditor('<?=$ziduan?>',{
  17. serverUrl: "/e/extend/ueditor/php/controller.php",//自己的请求接口
  18. toolbars:Default,//工具栏配置文件,具体参考ueditor.toolbarconfig.js文件中说明
  19. pageBreakTag:'[!--empirenews.page--]',//帝国分页标签
  20. initialFrameWidth:'100%',//编辑器宽
  21. initialFrameHeight:300//编辑器高
  22. //等等其它配置自行添加,参考UE默认配置文件复制修改即可
  23. //自定义请求参数
  24. <?=$ziduan?>.ready(function(){
  25. <?=$ziduan?>.execCommand('serverparam',{
  26. 'filepass':'<?=$filepass?>',//修改时候是信息ID
  27. 'classid' :'<?=$classid?>',
  28. 'qiantai':<?=$qiantai?>
  29. </script>
  30. <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#DBEAF5">
  31. <tr>
  32. <td bgcolor="#FFFFFF">
  33. <input name="dokey" type="checkbox" value="1"<?=$r[dokey]==1?' checked':''?>>关键字替换  
  34. <input name="copyimg" type="checkbox" id="copyimg" value="1">远程保存图片(
  35. <input name="mark" type="checkbox" id="mark" value="1">
  36. <a href="SetEnews.php" target="_blank">加水印</a>)  
  37. <input name="copyflash" type="checkbox" id="copyflash" value="1">远程保存FLASH(地址前缀:
  38. <input name="qz_url" type="text" id="qz_url" size="">)
  39. </td>
  40. </tr>
  41. <tr>
  42. <td bgcolor="#FFFFFF">
  43. <input name="repimgnexturl" type="checkbox" id="repimgnexturl" value="1"> 图片链接转为下一页   <input name="autopage" type="checkbox" id="autopage" value="1">自动分页,每 <input name="autosize" type="text" id="autosize" value="5000" size="5">个字节为一页   取第
  44. <input name="getfirsttitlepic" type="text" id="getfirsttitlepic" value="" size="1">张上传图为标题图片(
  45. <input name="getfirsttitlespic" type="checkbox" id="getfirsttitlespic" value="1">缩略图: 宽
  46. <input name="getfirsttitlespicw" type="text" id="getfirsttitlespicw" size="3" value="<?=$public_r[spicwidth]?>">*高
  47. <input name="getfirsttitlespich" type="text" id="getfirsttitlespich" size="3" value="<?=$public_r[spicheight]?>">)
  48. </td>
  49. </tr>
  50. </table>

字段HMTL代码修改截图:

帝国CMS7.5版本整合百度编辑器(UEditor)教程方法

编辑器调用截图:

帝国CMS7.5版本整合百度编辑器(UEditor)教程方法注释:编辑器的字段代码修改为你当前字段的字段名即可。

controller.php为上传等接口文件,替换官方原版的即可,在php目录下。

ueditor.toolbarconfig.js为工具栏配置文件js,默认配置两项,全功能和演示简版两种,其他的自行添加。另外此文件还提供了一个附件管理的外部接口js

修改百度编辑器的目录的时候,对应的文件也需要修改,比如引入的js路径,php文件路径等。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK