網站教程很多了,關于ueditor我也不做過多介紹了,官網上都有。這里著重說說個人使用時遇到的問題 分享給大家
1.去ueditor官網下載最新的php版本 http://ueditor.baidu.com解壓后,將文件夾的名字改為ueditor,上傳至網站根目錄的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. style=width:100%;>.$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)設置--核心設置修改編輯器為ueditor
至此,后臺的編輯器已經可以使用了,但最主要的還是前臺看到。下面的步驟就很重要了(慚愧的說本人卡在這很久)
5.在你的文章頁模板的底部....中加入如下代碼!
12345 <script type=text/javascript>
syntaxhighlighter.highlight();
var editor_a = new baidu.editor.ui.editor();
editor_a.render( 'myeditor' );
</script>
并在內容頁的模板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的目錄下對應的文件目錄
6.最后更新緩存,生成文檔!
更多信息請查看IT技術專欄