2

我是 Yii 框架的新手,我的 CMS 管理页面需要一个 FCK 编辑器。我将 FCKeditor 下载并解压到根文件夹,并将其扩展名放在 yii 扩展文件夹中。我在我的视图中添加了以下代码

<?php $this->widget('application.extensions.fckeditor.FCKEditorWidget',array(
    "model"=>$model,                # Data-Model
    "attribute"=>'content',         # Attribute in the Data-Model
    "height"=>'400px',
    "width"=>'100%',
    "toolbarSet"=>'Basic',          # EXISTING(!) Toolbar (see: fckeditor.js)
    "fckeditor"=>Yii::app()->basePath."/../fckeditor/fckeditor.php",
                                    # Path to fckeditor.php
    "fckBasePath"=>Yii::app()->baseUrl."/fckeditor/",
                                    # Realtive Path to the Editor (from Web-Root)
    "config" => array(
        "EditorAreaCSS"=>Yii::app()->baseUrl.'/css/index.css',),
                                    # http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/Configuration_Options
                                    # Additional Parameter (Can't configure a Toolbar dynamicly)
    ) ); ?>

这些都工作正常。但编辑器单独显示。我需要编辑器代替内容文本区域。在此处输入图像描述

4

1 回答 1

1
<?php echo CHtml::activeTextArea($model,'content',array('rows'=>6, 'cols'=>50)); ?>

要使用 FCKEditor 而不是上面的 textarea,请通过将上面的代码替换为以下代码来调用集成小部件:

<?php $this->widget('application.extensions.fckeditor.FCKEditorWidget',array(
 'model'     =>  $model,
 'attribute' => 'content',
 'height'    =>  '600px',
 'width'     =>  '100%',
 'fckeditor' =>  dirname(Yii::app()->basePath).'/htdocs/fckeditor/fckeditor.php',
 'fckBasePath' => Yii::app()->baseUrl.'/fckeditor/')
 ); ?>

你做了这样的事情吗,如果你这样做了,那么文本区域将被编辑器替换,希望对你有所帮助

于 2012-05-08T06:09:51.633 回答