给你的MT整合 WYSIWYG 编辑器 FCKeditor

在众多 WYSIWYG 编辑器中,FCKeditor算是不错的一个,可以与很多程序相结合

在与MT的结合方面也做得很不错,下面我们来看看步骤

  1. Download FCKeditor (我用的是2.1.1) 解压到 MT 的static 目录,如 mt-static. 完了后会在该目录下生成一个名为 FCKeditor 的目录.
  2. 打开 FCKeditor/fckeditor.js 文件,检查 this.BasePath 的路径,因为一般MT的后台可能都是Linux,所以要注意大小写的问题,this.BasePath  默认是小写 fckeditor,所以你可以改成FCKeditor ,注意,这个文件通常是只读的,记得改变权限后再去编辑
  1. 打开 /tmpl/cms/header.tmpl  文件,另存为: header_edit_entry.tmpl

  2. 编辑 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>

  3. 打开 /tmpl/cms/edit_entry.tmpl 文件,把 <TMPL_INCLUDE NAME="header.tmpl"> 替换为<TMPL_INCLUDE NAME="header_edit_entry.tmpl">

  4. 删除MT原来自带的 (edit_entry.tmpl) 编辑按钮. 类似于 B, I, U 什么的,要删除2次:

    <script type="text/javascript">
    <!--
    if (canFormat) {
        with (document) {
            write('<a title="<MT_TRANS phrase="Bold" escape="singlequotes">
    [...]
        }
    }
    // -->
    </script>

    注意:  Entry Body 和 Extended Entry 段各山河
  5. 编辑 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']
    ] ;

  6. 接下来为继续添加以下代码,主要是去掉一些摘要(Excerpt)部分不需要的功能:

    FCKConfig.ToolbarSets["MTExcerpt"] = [
     ['Source'],
     ['Bold','Italic','Underline','-','OrderedList','UnorderedList','-','Link','Unlink','-','About']
    ] ;
  7. 最后,禁用自带的图像和链接浏览器:

    FCKConfig.LinkBrowser = false ;
    FCKConfig.ImageBrowser = false ;

  8. That's all! Good luck! 

PS. 这个编辑器很占资源,机器配置不好的朋友不建议使用。

2 Comments

嘿嘿,前面还在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" />');

Leave a comment

Recent Entries

  • Lync Server 2010 发布架构报错

    昨天想试试在现有的 OCS 2007 R2 的基础上部署 Lync Server 2010 试试看,装好 Topology Builder 之后,新建了一个拓扑,然后把该填的都填了,发布的时候老是报SQL错,很是郁闷,后来终于在log中找到了错误原因:  Script result: ERROR_VALIDATE_BAD_SQL_VERSION Error: Script failed (code "ERROR_VALIDATE_BAD_SQL_VERSION") when installing "CentralMgmtStore" on "LyncServer01.mail2any.local"....

  • 使用 URL Rewrite 重定向 Http 请求至 Https

    公司部署了个新的 IIS 站点,需要强制在 Https 下面访问,但是又不希望关掉80端口的 Http 请求,这样对用户体验来讲不好,最好是能强制所有的 Http 请求都会被重定向到 Https 上面去,显然, IIS 自带的 "HTTP Redirect" 已经不能满足这个需求,我们这里使用 IIS 7.0 下面的重定向扩展 URL Rewrite Module 来做。1. http://www.iis.net/download/URLRewrite 到这里下载,有分...

  • How to remember your OC and Outlook password

    How to make your computer remember your Microsoft Communicator 2007 R2 and Outlook 2007 password (如何让你的电脑在非域环境中记住 OC 2007 R2 和 Outlook 的密码)我们知道,在域的环境中,使用 OC 和 Outlook...

  • 微软 CRM 2011 Beta 快速安装图解

    微软在9月17日在网站上放出了 CRM 2011 (也就是CRM5.0)的 beta 版本,我就先来个简单的快读安装图解,一睹为快,下个月会写点新版 CRM 的使用感受。 下载: Microsoft Dynamics CRM 2011 Beta Microsoft Dynamics CRM 2011 Software Development Kit (SDK)Microsoft Dynamics CRM 2011...

  • 升级到 Exchange 2010 SP1 后出现的2个小问题

    今天有空把所有的 Exchange 服务器从 2010 RTM 升级到了 2010 SP1 了, 升级完了后发现了2个小问题: OWA打开正常,但是点到 ECP 的时候报 403 访问拒绝错误 某台 Exchange 打开 EMS 时报错如下: [server.mydomain.local] Connecting to remote server failed...

Close