---
title: "ZF+Smarty+FCKeditor"
author: "ranfow"
date: "2008-09-05T13:05:46Z"
tags: []
slug: "zf-smarty-fckeditor"
draft: false
lastmod: "2008-09-05T13:05:46Z"
id: 237519
url: "https://ranfow.iteye.com/blog/237519"
---

一、在index.php中加载fckeditor.php：

 require\_once "fckeditor/FCKeditor.php";  // 我把fckeditor文件夹放include下面，且将include设为include\_path

二、在xxxController类中添加editorAction：

 public function editorAction()  
    {  
        $editor = new FCKeditor('content');  
        $editor-&gt;BasePath = $this-&gt;\_view-&gt;baseUrl . './include/fckeditor/';  // 指定fckeditor路径  
        $editor-&gt;Width = '600';  
        $editor-&gt;Height = '400';  
        $editor-&gt;Value = '请在此处输入内容';  
        $this-&gt;\_view-&gt;editor = $editor-&gt;CreateHtml();    // 生成fckeditor后赋给editor或在模板中生成  
        $this-&gt;\_view-&gt;display('editor.tpl');  
    }    // 注：$this-&gt;\_view为Smarty对象

三、在页面中生成fckeditor  
只需在模板文件中添加以下语句即可：

 &lt;{$editor}&gt;

四、在fckeditor目录下创建.htaccess，其内容为：RewriteEngine off