关于我在ZF中使用FckEditor的方法

来源:互联网 发布:泳衣面料 知乎 编辑:程序博客网 时间:2024/04/29 11:09
目录放置在
index.php
    ---js
        ---fckeditor
控制器中写入以下内容
public function AddAction()
  {
     
      Zend_Loader::loadFile('fckeditor_php5.php','./js/fckeditor');
      $sBasePath = WWWROOT.'js/fckeditor/';
      $oFCKeditor = new FCKeditor('FCKeditor') ;
      $oFCKeditor->BasePath    = $sBasePath ;
      $oFCKeditor-> Height    = 450 ;
       //通过create方法,返回html内容,不是echo
      $this -> view -> fckeditor = $oFCKeditor->Create();
  } 

还得修改fckeditor目录下的fckeditor_php5.php中的代码
fckeditor类中
function Create()
    {
        echo $this->CreateHtml() ;
    }

修改成以下
function Create()
    {
        return $this->CreateHtml() ;
    }

再通过视图输入
<?php echo $this -> fckeditor; ?>

要取得编辑器中的内容JS是
var ōEditor = FCKeditorAPI.GetInstance('FCKeditor');
var content = oEditor.GetHTML()
content就是编辑器中的内容

还有就是在fckeditor目录下放一人.htaccess文件。关闭重写引擎
RewriteEngine Off

 
原创粉丝点击