在众多 WYSIWYG 编辑器中,FCKeditor算是不错的一个,可以与很多程序相结合
在与MT的结合方面也做得很不错,下面我们来看看步骤
- Download FCKeditor (我用的是2.1.1) 解压到 MT 的static 目录,如 mt-static. 完了后会在该目录下生成一个名为 FCKeditor 的目录.
- 打开 FCKeditor/fckeditor.js 文件,检查 this.BasePath 的路径,因为一般MT的后台可能都是Linux,所以要注意大小写的问题,this.BasePath 默认是小写 fckeditor,所以你可以改成FCKeditor ,注意,这个文件通常是只读的,记得改变权限后再去编辑
- 打开 /tmpl/cms/header.tmpl 文件,另存为: header_edit_entry.tmpl
- 编辑 header_edit_entry.tmpl 文件,在 <head> ...
</head>标签之间添加以下代码
<script type="text/javascript"
src="<TMPL_VAR NAME=STATIC_URI>FCKeditor/fckeditor.js"></script>
<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor( 'text' ) ;
oFCKeditor.BasePath = '<TMPL_VAR NAME=STATIC_URI>FCKeditor/' ;
oFCKeditor.Width = 580 ;
oFCKeditor.Height = 400 ;
oFCKeditor.CheckBrowser = true ;
oFCKeditor.ReplaceTextarea() ;
pFCKeditor = new FCKeditor( 'text_more' ) ;
pFCKeditor.BasePath = '<TMPL_VAR NAME=STATIC_URI>FCKeditor/' ;
pFCKeditor.Width = 580 ;
pFCKeditor.Height = 400 ;
pFCKeditor.CheckBrowser = true ;
pFCKeditor.ReplaceTextarea() ;
qFCKeditor = new FCKeditor( 'excerpt' ) ;
qFCKeditor.BasePath = '<TMPL_VAR NAME=STATIC_URI>FCKeditor/' ;
qFCKeditor.ToolbarSet = "MTExcerpt" ;
qFCKeditor.Width = 580 ;
qFCKeditor.Height = 200 ;
qFCKeditor.CheckBrowser = true ;
qFCKeditor.ReplaceTextarea() ;
}
</script>
- 打开 /tmpl/cms/edit_entry.tmpl 文件,把 <TMPL_INCLUDE
NAME="header.tmpl"> 替换为<TMPL_INCLUDE
NAME="header_edit_entry.tmpl">
- 删除MT原来自带的 (edit_entry.tmpl) 编辑按钮. 类似于 B, I, U 什么的,要删除2次:
注意: Entry Body 和 Extended Entry 段各山河<script type="text/javascript">
<!--
if (canFormat) {
with (document) {
write('<a title="<MT_TRANS phrase="Bold" escape="singlequotes">
[...]
}
}
// -->
</script>
-
编辑 FCKeditor.js 文件(可选)修改默认的 toolbar
将Default ToolbarSet 一段的代码替换为:
FCKConfig.ToolbarSets["Default"] = [
['Source'],
['Cut','Copy','Paste','PasteText','PasteWord','-'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
['OrderedList','UnorderedList','-','Outdent','Indent'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink','Anchor'],
['Image','Table','Rule','Smiley','SpecialChar','UniversalKey'] ,
['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'],
' /',
['Style','FontFormat','FontName','FontSize'],
['TextColor','BGColor'],
['About']
] ; - 接下来为继续添加以下代码,主要是去掉一些摘要(Excerpt)部分不需要的功能:
FCKConfig.ToolbarSets["MTExcerpt"] = [
['Source'],
['Bold','Italic','Underline','-','OrderedList','UnorderedList','-','Link','Unlink','-','About']
] ; - 最后,禁用自带的图像和链接浏览器:
FCKConfig.LinkBrowser = false ;
FCKConfig.ImageBrowser = false ;
- That's all! Good luck!
PS. 这个编辑器很占资源,机器配置不好的朋友不建议使用。

嘿嘿,前面还在msn上问你呢……好详细
5. 删除MT原来自带的 (edit_entry.tmpl) 编辑按钮.
这个如何改呢?把那段代码加进去就可以了吗?
不是加代码,而是去掉代码,比如删除
write('" href="#" onclick="return formatStr(document.entry_form.text, \'strong\')">images/html-bold.gif" alt="" width="22" height="16" />');
write('" href="#" onclick="return formatStr(document.entry_form.text, \'em\')">images/html-italic.gif" alt="" width="22" height="16" />');
write('" href="#" onclick="return formatStr(document.entry_form.text, \'u\')">images/html-underline.gif" alt="" width="22" height="16" />');