用户
 找回密码
 入住 CI 中国社区
搜索
查看: 4120|回复: 4
收起左侧

在谈关于FCKeditor的使用

[复制链接]
发表于 2009-4-24 22:33:26 | 显示全部楼层 |阅读模式
在论坛里,关于这个话题,已经很多了。可是按照上面的方法却没有成功过。按照这位网友的说法,我修改一些后终于调用成功(以下是原文):

    用了CI没多少天,因为要开始做一个项目,发布产品急需用到FCK,后来在论坛上找关于CI集成FCK的文章,有很多,但绝大部分的文章都是复制——粘贴别人的文章,可谓一字不漏。当我尝试的时候试了一个通宵,直到年初三早上6点半,没一个能调用出来的,当时郁闷的很,很讨厌这些不负责任的粘贴行为。后来睡醒觉,在看到新浪一篇文章,本论坛上也有很多人发表fck复制的文章,(http://blog.sina.com.cn/s/blog_4b93170a0100b1e4.html)尝试了下,不行,再修改,结果行了!现在我把这篇文章修改后成功的代码发出来:

1.
下载解压FCKeditor 2.6,我是放在system/application/plugins/fckeditor/ 下。

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

3. 打开此
文件,将类名更改为 Fckeditor,并修改你的构造器
$this->BasePath
定义为你的fckeditor的目录,我的是$this->BasePath = base_url
().'system/application/plugins/fckeditor/'  ;
PHP
// PHP 5
    function __construct( $instanceName )
     {
        $this->InstanceName    = $InstanceName['name'];
        $this->BasePath        = base_url().'system/application/plugins/fckeditor/' ;
        $this->Width        = $InstanceName['width'] ;
        $this->Height        = $InstanceName['height'] ;
        $this->ToolbarSet    = 'Default' ;
        $this->Value        = '' ;
        $this->Config        = array() ;
    }
复制代码
4. 打开 ./system/application/libraries/下的 fckeditor.php,复制FCKeditor_IsCompatibleBrowser()函数里的所有内容,替换到IsCompatible()函数里的所有内容

5.如果你使用了.htaccess文件,需要做如下修改

RewriteCond $1 !^(index\.php|images|system/application/plugins/fckeditor)


6.
基本设置完毕,在
控制器中调用直接输出测试:
PHP
  $this->load->helper('url');
  $info = array('name' => 'product','width'=>600,'height'=>200);
  $this->load->library('fckeditor',$info);
  $this->fckeditor->Value='测试成功';
  $this->fckeditor->Create();



我按照这朋友的方法,可惜,不能调用失败。最后,我把FCKeditor 2.6放在index.php同级目录下,才成功了。

评分

参与人数 1威望 +5 收起 理由
Hex + 5 我很赞同

查看全部评分

发表于 2009-5-2 17:07:04 | 显示全部楼层
原来如此~~
发表于 2009-5-15 08:31:00 | 显示全部楼层
我也是 把 fckeditor 放置 在 index.php 同層底下 RewriteCond 本身就設定為 不可瀏覽 system 資料夾這樣比較安全 CI 本身就是透過 index.php 驅動出入
发表于 2009-5-27 11:42:51 | 显示全部楼层
还是失败我哭。。。。
发表于 2009-5-31 18:31:57 | 显示全部楼层
用js调用,就没那么麻烦了

本版积分规则