网站教程很多了,关于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 .进入后台系统设置--核心设置修改编辑器为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技术专栏
2025国考·省考课程试听报名