杏糖兜油菜 发表于 2008-10-15 16:47:47

为CodeIgniter(v1.6.3) 安装FCKeditor插件

一篇博客中很好的文章,原文:http://blog.sina.com.cn/s/blog_4b93170a0100b1e4.html



1. 下载解压FCKeditor 2.6.x, 然后放在system/application/plugins/fckeditor/ 下。

2.根据你的php版本,将fckeditor_php4.php或fckeditor_php5.php复制到 /system/application/libraries/ 下,并更名为 fckeditor.php

3. 打开此文件,将类名更改为 Fckeditor,并修改你的构造器

// PHP 5
    function __construct( $instanceName )
   {
      $this->InstanceName    = $instanceName ;
      $this->BasePath      = '/fckeditor/' ;
      $this->Width      = '100%' ;
      $this->Height      = '200' ;
      $this->ToolbarSet    = 'Default' ;
      $this->Value      = '' ;
      $this->Config      = array() ;
    }
// PHP 4
    function Fckeditor( $instanceName )
    {
      $this->__construct( $instanceName ) ;
    }


4. 打开 ./system/application/libraries/下的 fckeditor.php,复制FCKeditor_IsCompatibleBrowser()函数里的所有内容,替换到IsCompatible()函数里的所有内容

5. 修改 ./system/application/libraries/fckeditor.php 的 constructor 里的 basepath 定义
      $this->BasePath = base_url().'system/application/plugins/fckeditor/';

6.如果你使用了.htaccess文件,需要做如下修改
   RewriteCond $1 !^(index\.php|images|system/application/plugins/fckeditor)



7. 基本设置完毕,在控制器中调用:
      $this->load->library('fckeditor','content');
      $this->fckeditor->ToolbarSet = 'Basic';
      $data['fckeditor']=$this->fckeditor->CreateHtml();


   在view里用 <?=$fckeditor?>就可以了

8.如果要在一个页面显示多个fckeditor



$this->load->library('fckeditor', 'FCKEDITOR1');

$this->fckeditor->BasePath = 'system/plugins/FCKeditor/';
$this->fckeditor->ToolbarSet = 'Basic';

$data['fck1'] = $this->fckeditor->CreateHtml();
      
$this->fckeditor->InstanceName = 'FCKEDITOR2';
      
$data['fck2'] = $this->fckeditor->CreateHtml();

$this->load->view('mypage', $data);

//在服务器端,可以这样:
$first_box = $this->input->post('FCKEDITOR1');
$second_box = $this->input->post('FCKEDITOR2');


其他的一些配置,你可以在fckconfig.js中自己修改

[ 本帖最后由 杏糖兜油菜 于 2008-10-15 22:28 编辑 ]

Hex 发表于 2008-10-15 17:10:05

太好了!很多人都不会配置 FCKEditor,楼主是好人!加分

sam 发表于 2008-10-15 17:37:12

http://blog.sina.com.cn/s/blog_4b93170a0100b1e4.html

pujing 发表于 2008-10-15 21:48:47

:handshake :handshake :handshake

yygcom 发表于 2008-10-17 17:05:50

FCK是个好东东,不过感觉还是用js调用来的实在,个人之见,仅供参考
http://www.jiayuan.com/15284073

沧蓝 发表于 2008-11-9 15:01:50

我想怎么看着那么眼熟,原来那篇blog是抄的我的帖子:

http://codeigniter.org.cn/forums/viewthread.php?tid=259

Hex 发表于 2008-11-9 21:08:13

严厉打击抄袭帖子的行为!

daofeng125 发表于 2008-11-16 10:25:46

hex   :lol就事论事啊!

johnwei01 发表于 2009-1-28 04:39:03

不负责任的抄袭行为,论坛的都试过,除了js的外其他都是不行的,楼主有心的就把配置好FCK的CI打包让我们下载。

gumoon 发表于 2009-2-1 18:04:45

挺好
学习了
很强大
呵呵
谢谢
页: [1] 2
查看完整版本: 为CodeIgniter(v1.6.3) 安装FCKeditor插件