在应用EMlog模板时发现,后台编辑器采用的是KindEditor,而这款编辑器只是支持基本的文本编辑功能,甚至不能正常的上传图片、附件,只能依靠EMlog自带的附件上传功能,这样对文章的编辑受到很大限制,所以楼主想到更换编辑器以改善文章的编辑能力。
首先下载最新CKEditor安装文件:ckeditor_4.4.5_full
你还可以登录 http://ckeditor.com/download 注册 登录 然后可以自由选择编辑器标准版或是完整版,并且可以自选插件。
将压缩文件解压,然后用FTP上传到根目录 admin/ 文件夹下(原来的KindEditor就是那个editor文件夹)。
然后就是编辑器的引用了:
到 admin/views/ 文件夹下,找到add_log.php(用于添加文章)和edit_log.php(用于编辑文章);
add_log.php中找到:
<textarea id="content" name="content" cols="100" rows="8" style="width:800px; height:460px;"></textarea>
将 id="content" 修改为 id="editor1"
edit_log.php中找到:
<textarea id="content" name="content" style="width:800px; height:460px; border:#CCCCCC solid 1px;"><?php echo $content; ?></textarea>
同样将 id="content" 修改为 id="editor1"
修改后,将</textarea> 后边添加:(这两个文件都要加)
<script>
// Replace the <textarea id="editor1"> with a CKEditor
// instance, using default configuration.
CKEDITOR.replace( 'editor1' );
</script>
以上讲了编辑器的替换操作,别忘了要在这两个文件的:
<?php if(!defined('EMLOG_ROOT')) {exit('error!');}?>
下方加上引用CKEditor编辑器的javascript:
<script src="./ckeditor/ckeditor.js"></script>
就是这么任性,刷新你后台添加文章或编辑文章的页面,a new editor is comming !
样式控制插件:ckeditor_css.zip
已有 6/5637 人参与
评论:
发表评论: