lyic_lee 发表于 2009-4-24 22:33:26

在谈关于FCKeditor的使用

在论坛里,关于这个话题,已经很多了。可是按照上面的方法却没有成功过。按照这位网友的说法,我修改一些后终于调用成功(以下是原文):

    用了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同级目录下,才成功了。

star65225692 发表于 2009-5-2 17:07:04

{:3_55:}原来如此~~

showsky 发表于 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调用,就没那么麻烦了
页: [1]
查看完整版本: 在谈关于FCKeditor的使用