將織夢dedecms后臺編輯器更改為Ueditor

字號:


    網(wǎng)站教程很多了,關(guān)于ueditor我也不做過多介紹了,官網(wǎng)上都有。這里著重說說個人使用時遇到的問題 分享給大家
    1.去Ueditor官網(wǎng)下載最新的php版本 http://ueditor.baidu.com解壓后,將文件夾的名字改為ueditor,上傳至網(wǎng)站根目錄的include中。
    2.修改include中inc文件夾中的inc_fun_funAdmin.php文件(注意備份之前的文件)找到以下代碼(最新的大約在212行左右)
    $GLOBALS['tools'] = empty($toolbar[$etype])? $GLOBALS['tools'] : $toolbar[$etype] ;
    $config['toolbar'] = $GLOBALS['tools'];
    $config['height'] = $nheight;
    $config['skin'] = 'kama';
    $CKEditor->returnOutput = TRUE;
    $code = $CKEditor->editor($fname, $fvalue, $config, $events);
    if($gtype=="print")
    {
    echo $code;
    }
    else
    {
    return $code;
    }
    }
    ****
    else {
    3.在****位置加入如下代碼
    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>
    <script type="text/javascript" charset="utf-8"
    src="".$GLOBALS["cfg_cmspath"]."/include/ueditor/ueditor.all.js"></script>
    <link rel="stylesheet" type="text/css"
    href="".$GLOBALS["cfg_cmspath"]."/include/ueditor/themes/default/css/ueditor.css"/>
    <textarea name="".$fname."" id="".$fname."">".$fvalue."</textarea>
    <script type="text/javascript">var ue = new
    baidu.editor.ui.Editor();ue.render("".$fname."");</script>";
    if($gtype=="print")
    {
    echo $code;
    }
    else
    {
    return $code;
    }
    }
    4 .進入后臺系統(tǒng)設(shè)置--核心設(shè)置修改編輯器為ueditor
    至此,后臺的編輯器已經(jīng)可以使用了,但最主要的還是前臺看到。下面的步驟就很重要了(慚愧的說本人卡在這很久)
    5.在你的文章頁模板的底部....中加入如下代碼!
    12345 <script type="text/javascript">
    SyntaxHighlighter.highlight();
    var editor_a = new baidu.editor.ui.Editor();
    editor_a.render( 'myEditor' );
    </script>
    并在內(nèi)容頁的模板head中加入如下代碼
    12 <script type="text/javascript" src="/include/ueditor/third-party/SyntaxHighlighter/shCore.js"></script>
    <link type="text/css" rel="stylesheet" href="/include/ueditor/third-party/SyntaxHighlighter/shCoreDefault.css" />
    *注意路徑,更改為你ueditor的目錄下對應(yīng)的文件目錄
    6.最后更新緩存,生成文檔!