下载插件:
在官网已无法下载了,忘记在哪下载的了,下面是我在快盘的分享链接。
http://www.kuaipan.cn/file/id_17143507990890841.html
另外,在boylee的yiiblog视频系列里有详细的解绍。且放置了一个115的链接。
http://yiiblog.info/blog/yii-go/
CKediter - http://u.115.com/file/dnsrnmom
ps:我放的版本和boylee的版本可能不一样,但基本用法是相同的。
放置插件,很简单,将editor的包解压后放置在extensions里面。
在视图文件里使用:
<div class="row">
<?php echo $form->labelEx($model,'news_content'); ?>
<?php
$this->widget('application.extensions.editor.CKkceditor',array(
"model" => $model, // Data-Model
"attribute" => 'news_content', // Attribute in the Data-Model
"height" => '400px',
"width" => '100%',
"filespath" => Yii::app ()->basePath . "/../uploadImages/paquetes/" ,
"filesurl" => Yii::app ()->baseUrl . "/uploadImages/paquetes/" ,
) );
?>
<?php echo $form->error($model,'news_content'); ?>
</div>
这是按照boylee的视频做得,修改的部分包括:attribute属性,这里要修改成model里要修改内容的字段名,然后是filespath和filesurl这里的经验是不要用model里的isNewRecord方法来判断,否则不能显示上传到服务器的图片,这里有些偷懒,没有查看源文档的说明,只是将图片路径修改成了一个,其次,路径要存在。
下面给出另外一个配置参考:
<div class="row">
<?php echo $form->labelEx($model,'news_content'); ?>
<?php
$this->widget ( 'application.extensions.editor.CKkceditor', array (
"model" => $model, // Data-Model
"attribute" => 'news_content', // Attribute in the Data-Model
"height" => '400px',
"width" => '100%',
"config" => array (
"config.toolbar" => 'Full',
"config.toolbar_Full" => "[
['Source','-','Save','NewPage','Preview','-','Templates'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],
'/',
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['BidiLtr', 'BidiRtl'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'],
'/',
['Styles','Format','Font','FontSize'],
['TextColor','BGColor'],
['Maximize', 'ShowBlocks','-','About']
]"
),
"filespath" => (! $model->isNewRecord) ? Yii::app ()->basePath . "/../uploadImages/paquetes/" : "",
"filesurl" => (! $model->isNewRecord) ? Yii::app ()->baseUrl . "/uploadImages/paquetes/" : ""
) );
?>
<?php echo $form->error($model,'news_content'); ?>
</div>
上面这个配置是我在做练习的另一个实例,这个里面用了isNewRecord判断,结果是可行的,具体原因没有研究,有兴趣的朋友可以研究下,分享下经验。