2012-05-08 5 views
2

私はYiiフレームワークを初めて利用しました。 CMS管理ページのFCKエディタが必要です。私はFCKeditorをルートフォルダとyii拡張フォルダの拡張子にダウンロードして解凍しました。私は私の見解で次のコードを追加しましたYiiでFCKエディタを設定するには?

<?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) 
    )); ?> 

これらはすべて正常に動作しています。 が表示されますが、エディタは個別に表示されます。私はコンテンツのテキストエリアの代わりにエディタが必要です。 enter image description here

+2

私はFCKエディタを見るたびに、それは別のことを言うと思う... – goat

答えて

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

と次のようにコードの上に置き換えることにより、統合ウィジェットを起動し、代わりに上記のテキストエリアのFCKEditorのを使用するには:

<?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/') 
); ?> 

あなたはこの方法でやった場合は、このような何かをしましたテキストエリアは、エディタに置き換えられ、助けてくれることを願って

+0

ええ、それは...うまく動作します。私はjqueryモデルの置き換えに従っています、それは繰り返しです..ありがとう – nu6A

関連する問題