整合Zend Framework和Fckeditor

Fckeditor是一款功能强大且开源的HTML在线编辑器,在许多场合都会用到。要将其整合到Zend Framework中其实步骤很简单。

1. 下载最新版本的Fckeditor,然后解压缩至Zend Framework程序的 public 目录下的editor目录,删除其中不需要的js/perl/asp等文件。
2. Fckeditor为了兼容php4有两个可供调用的Fckeditor class.考虑到Zend Framework的PHP5的要求,直接删除fckeditor.php,fckeditor_php4.php这两个文件,并将fckeditor_php5.php重新命名成Fckeditor.php,将其移动到models目录下。
3. 在你的Controller文件中就可以直接调用了:
<?php

public function xxxAction()
{
     $editor = new Fckeditor(”content”); //content为Fckeditor文本框的名字
     $editor->BasePath = $this->view->baseUrl.”/public/fckeditor/”;
     $editor->Value = “请在此处输入文章内容”;
     $this->view->editor = $editor->CreateHtml(); //调用CreateHtml方法产生html语句供视图模板调用。
     $this->render();
}

在模板文件里 xxx.phtml
<?php echo $this->editor;?> 就可以显示Fckeditor的文本编辑器了!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值