drupal学习经验(ckeditor的安装配置)

张映 发表于 2011-01-06

分类目录: drupal

标签:, ,

ckeditor在fkceditor基础上又一个不错的html编辑器,在新建node的时候,在用户评论的时候,有这样的编辑器,用户体验是非常的不错的

一,drupal的ckeditor模块安装

1,下载ckeditor

下载地址:http://drupal.org/project/ckeditor

这里下载的东西,并不是真正的ckeditor,这里面的ckeditor只不过是一个外壳,真正的实体,你还要到ckeditor的官方网站上去下载.

下载地址:http://ckeditor.com/download

2,安装ckeditor

将从drupal官网上下载的ckeditor,解压后放到sites/all/modules/下面,在将在ckeditor官网上下载的ckeditor解压后文件放到,sites/all/modules/ckeditor/ckeditor/下面,目录结构是这样的

zhangy@ubuntu:~/www/drupal/sites/all$ tree -d .
.
`-- modules
 |-- ckeditor                //这一层是从drupal官网下载的ckeditor
 |   |-- ckeditor
 |   |   |-- ckeditor        //这一层是从ckeditor官网下载的ckeditor
 |   |   |-- includes

文件放好后administor=>site building=>modules下面把ckeditor这个模块启用

三,配置ckeditor

配置的地方是administor=>site configuration=>ckeditor进去的时候,如果从ckeditory官网下载的源码目录存放有错误,会提示你错误,

After that you must extract the files to sites/all/modules/ckeditor/ckeditor or sites/all/libraries/ckeditor and make sure that the file sites/all/modules/ckeditor/ckeditor/ckeditor.js or sites/all/libraries/ckeditor/ckeditor.js exist.

意思说的很明显了,还缺少一个ckeditor.js

错误解决方法:将sites/all/modules/ckeditor/ckeditor/ckeditor/ckeditor.js这个文件copy一份到sites/all/modules/ckeditor/ckeditor下面,如果你这样做了,会提示你m.lang.contextmenu is undefined(用firebug看的).

所以目录千万不要放错了。

ckeditor的编辑器中有很多东西,看下图:

ckeditor all

ckeditor all

像上面的东西,太多,有很多都是我不想要的,我要怎么配置里面的东西,我们可以编辑sites/all/modules/ckeditor/ckeditor.config.js这个文件

config.toolbar_DrupalFiltered = [
 ['Source'],
 ['Cut','Copy','Paste','PasteText'],
 ['Bold','Italic','Underline'],
 ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
 ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock']
 ];

上面的这段js,是我编辑过的,这里面的是我需要的。看一下效果图

ckeditor need

ckeditor need



转载请注明
作者:海底苍鹰
地址:http://blog.51yip.com/drupal/1199.html