Yii中ckediter进一步配置
来源:互联网 发布:丁丁历险记 知乎 编辑:程序博客网 时间:2024/05/29 11:03
废话篇:由于本人没有安装录制桌面视频的软件,所以只能采用这种doc文档的方式。
Boylee呢已给大家在视频中讲了ckeditor的使用,非常感谢boylee 我连夜从yiiblog下载玩视频通宵看完。收获颇多。也是自己以后对自己复习ckeditor的使用有个文档依据写这个教程好了废话不多说了进入 正题。
关于ckeditor 的工具栏是可以实现定制的。Yii 的扩展extension中的ckeditor的toolbar也是可以实现定制的。下面就从boylee 的视频结束讲解,视频下载可以从网站yiiblog中下载地址:http://yiiblog.info/blog/yii-go/ 下载视频教程3_5_3_extension_ckedit.mov还有editor扩展包CKediter- http://u.115.com/file/dnsrnmom
当然网站内还有很多视频教程。希望大家多学习。再次感谢boylee ,
下面如果您还不了解如何在yii中使用ckeditor 那么请认真的看一下boylee的视频教程。
在yii官方网站的extension 下载里面也能搜到ckeditor 但是没有下载文件包。
在yii 的extensions里面安装好并按照boylee的视频完成后。下面我们就要讲解一下 工具栏的自定义了。
找到 刚刚安装的extensions 里面editor/Ckkceditor.php文件。
你会发现变量$toolbarset已经声明;
而且如果你已经在你的Post页面安装了并调试好了ckeditor 你会发现和次代码非常类似
那么在你显示表单的页面你会看到和次断代码类似的代码
<?php $this->widget('application.extensions.editor.CKkceditor',array( "model"=>$model, "attribute"=>'content', # Attribute in the Data-Model "height"=>'400px', "width"=>'100%', "filespath"=>Yii::app()->basePath."/../upload/", "filesurl"=>Yii::app()->baseUrl."/upload/", ) ); ?>
添加一条配置给$toolbar设置值 如下:
<?php $this->widget('application.extensions.editor.CKkceditor',array( "model"=>$model, "attribute"=>'content', # Attribute in the Data-Model "height"=>'400px', "width"=>'100%', "toolbarSet"=>array( array( 'Source', '-', 'Bold','Italic', 'Underline', 'Strike' ), array( 'Image', 'Link','Unlink', 'Anchor' ) ), "filespath"=>Yii::app()->basePath."/../upload/", "filesurl"=>Yii::app()->baseUrl."/upload/", ) ); ?>
其中红色的部分就是我们要对ckeditor配置的自定义工具栏配置表单ckeditor 是按区域显示的所以 每个区域又是一个数组 同样也可以使用 '-' 这个分隔区域
然后 打开这个文件extensions 里面editor/Ckkceditor.php文件
我们要添加一些语句 找到如下语句:
$oCKeditor->basePath =$this->baseurl."/ckeditor/"; $oCKeditor->config['height'] =$this->height; $oCKeditor->config['width'] =$this->width;if (isset($this->config) &&is_array($this->config))
修改成如下语句:
$oCKeditor->basePath =$this->baseurl."/ckeditor/"; $oCKeditor->config['height'] =$this->height; $oCKeditor->config['width'] =$this->width; // 判断$toolbarSet是否配置 如配置并将值赋值给$this->config[‘toolbar’]; if(isset($this->toolbarSet) &&is_array($this->toolbarSet)) { $this->config['toolbar'] = $this->toolbarSet; } if (isset($this->config) &&is_array($this->config)) { foreach ($this->config as$key=>$value) { $oCKeditor->config[$key] = $value; } }
添加了上面的蓝色的语句判断一下
这样配置在页面显示的工具如下
如需更多的配置选项请参考一下配置字段:
['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'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
'/',
['Styles','Format','Font','FontSize'],
['TextColor','BGColor']
];
具体的字段呢 大家可以拿来试一下。Ok 写完了
=_= 困了 谁家了
By CodyHuny 2011-7-29 03:11
- Yii中ckediter进一步配置
- yii中urlmanager配置
- Yii中urlManager的配置
- Yii中urlManager的配置
- Yii中urlManager的配置
- Yii中urlManager的配置
- Yii中urlManager的配置
- Yii中配置Srbac模块
- 进一步探索:Windows Azure 网站中解锁的配置选项
- YII中一步一步的配置SRBAC
- yii中配置多数据库方法
- Yii中实现主从数据库配置方法
- wamp中Yii框架配置应用
- Gvim的进一步配置
- yii配置
- Yii配置
- 同一页面两个CKEDITER
- Yii学习笔记:进一步简化,提示信息跳转页面
- Linux rsync命令详解1
- 1099
- C# 多线程之新线程延时执行
- css 滤镜(filter)的用法
- Android 2.2 源码结构分析
- Yii中ckediter进一步配置
- 使用jquery的lazy loader插件实现图片的延迟加载
- 在html frame中实现注销功能
- Linux rsync命令详解2
- javascript中的 对象 和 原型
- 堆(heap)和栈(stack)、内存泄漏(memory leak)和内存溢出
- Activemq的连接方式
- 多线程讲解
- BitmapInfo Structure(BitmapInfo 结构来自MSDN)