按照官方的说法,太麻烦,fck的调用方式有两种,一种是通过javascript调用,一种是以服务器端形式的调用
本文以服务器端调用说起
下载fck编辑器之后,解压文件到app/webroot/js下,把php文件全部移除,暂时保留到其他位置
然后,找到fckeditor_php5.php这个文件,将这个文件放到components下,重命名为fck.php
将源码中的“class FCKeditor ”这行改为“class FckComponent extends Object”
然后接着找到fckeditor.php.复制FCKeditor_IsCompatibleBrowser函数到fck.php
接着修改fck.php的IsCompatible方法,将原文中的
return FCKeditor_IsCompatibleBrowser() ;
改为
return $this->FCKeditor_IsCompatibleBrowser() ;
最后修改构造函数,我是这么修改的
public function initalize( $instanceName,$width="100%",$height=350,$toolbar="Default")
{
$this->InstanceName = $instanceName ;
$this->BasePath =DS."js".DS."editor/" ;
$this->Width =$width ;
$this->Height =$height ;
$this->ToolbarSet =$toolbar ;
$this->Value = '' ;
$this->Config = array() ;
}
//调用方式
$this->Fck->initalize("content");
$this->set("fck",$this->Fck->CreateHtml());