織夢DEDECMS后臺HTML編輯器為百度編輯器的方法

字號:


    下面來一起看一篇織夢DEDECMS后臺HTML編輯器為百度編輯器的方法,這個例子可以幫助到很多朋友換一個編輯器了,有需要了解的朋友可進入?yún)⒖肌?BR>    網(wǎng)上試了好多代碼,終于找到這一段成功了,留存一下:
    代碼如下 
    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”文件,找到“獲取編輯器”段的函數(shù)“SpGetEditor”代碼,在其“else”前添加如上代碼;
    3、進入dedecms后臺→系統(tǒng)→系統(tǒng)基本參數(shù)→核心設(shè)置,修改html編輯器的名字為ueditor。