下面来一起看一篇织梦DEDECMS后台HTML编辑器为百度编辑器的方法,这个例子可以帮助到很多朋友换一个编辑器了,有需要了解的朋友可进入参考。
网上试了好多代码,终于找到这一段成功了,留存一下:
代码如下else if($GLOBALS[‘cfg_html_editor’]==’ueditor’)
{
$fvalue = $fvalue==” ? ‘<p></p>’ : $fvalue;
$code = ‘<script type=”text/javascript” charset=”utf-8″ src=”‘.$GLOBALS[‘cfg_cmspath’].’/include/ueditor/ueditor.config.js”></script>';
$code .= ‘<script type=”text/javascript” charset=”utf-8″ src=”‘.$GLOBALS[‘cfg_cmspath’].’/include/ueditor/ueditor.all.min.js”></script>';
$code .= ‘<link rel=”stylesheet” type=”text/css” href=”‘.$GLOBALS[‘cfg_cmspath’].’/include/ueditor/themes/default/css/ueditor.css”/>';
//$code .= ‘<textarea name=”‘.$fname.'” id=”‘.$fname.'” style=”width:100%;”>’.$fvalue.'</textarea>';
$code .= ‘<script type=”text/plain” name=”‘.$fname.'” id=”‘.$fname.'”>’.$fvalue.'</script>';
if($bbcode)
{
$code .= ‘<script type=”text/javascript”>UE.getEditor(“‘.$fname.'”,{toolbars:[[“Source”,”|”,
“bold”, “italic”, “underline”,”|”,”fontsize”,”forecolor”,”emotion”,”Undo”, “Redo”]],initialFrameHeight:100});</script>';
}
else
{
$code .= ‘<script type=”text/javascript”>UE.getEditor(“‘.$fname.'”,{initialFrameHeight:450});</script>';
}
if($gtype==”print”)
{
echo $code;
}
else
{
return $code;
}
}//bd end
替换步骤也简单记录一下:
1、下载ueditor并改好名字放在dedecms的“include”目录;
2、修改include目录中“inc”目录里的“inc_fun_funAdmin.php”文件,找到“获取编辑器”段的函数“SpGetEditor”代码,在其“else”前添加如上代码;
3、进入dedecms后台→系统→系统基本参数→核心设置,修改html编辑器的名字为ueditor。