|
本帖最后由 mvc999 于 2011-8-9 10:35 编辑
dilicms扩展ckeditor(fckeditor)编辑器,本人不才哪里有不对请及时拍砖啊!{:soso_e113:}
第一步:下载ckeditor
下载官方地址:http://ckeditor.com/download
第二步:ckeditor基本配置
解压ckeditor包,放到dilicms根目录下admincp\default\js\文件夹
为后dilicms后台框架文件 admincp\default\sys_entry.php 增加ckeditor的js引用
(根据自己的存放ckeditor的目录引用)
<script language="javascript" src="js/ckeditor/ckeditor.js"></script>
第三步:后台配置程序修改
修改settings\fieldtypes.php文件增加一项字段配置 "FCK" => "CK编辑器(FCK)",
例如:
$setting['fieldtypes'] = array(
"int" => "整形(INT)",
"float" => "浮点型(FLOAT)",
"input" => "单行文本框(VARCHAR)",
"textarea" => "文本区域(VARCHAR)",
"select" => "下拉菜单(VARCHAR)",
"select_from_model" => "下拉菜单(模型数据)(INT)",
"linked_menu" => "联动下拉菜单(VARCHAR)",
"radio" => "单选按钮(VARCHAR)",
"checkbox" => "复选框(VARCHAR)",
"wysiwyg" => "编辑器(TEXT)",
"wysiwyg_basic" => "编辑器(简)(TEXT)",
"FCK" => "CK编辑器(FCK)",//增加fck字段选项
"datetime" => "日期时间(VARCHAR)",
"colorpicker" => "颜色选择器(VARCHAR)"
);
第四步:核心类库application\libraries\dili\Form.php修改
在合适的地方增加一个新方法
function _FCK($field, $default)
{
$style = 'style="';
$style .= 'width:'. ($field['width'] ? $field['width'] : '400') .'px;';
$style .= 'height:'. ($field['height'] ? $field['height'] : '200') .'px;';
$style .= '"';
return '<textarea name="'. $field['name'] .'" id="'. $field['name'] .'" >'.$default.'</textarea><script type="text/javascript">CKEDITOR.replace("'. $field
['name'] .'", {extraPlugins :"autogrow",autoGrow_maxHeight : 400,removePlugins :"resize"});</script>';
}
第五步:模型文件application\models\dili\column_mdl.php修改
switch($data['type'])
{
case 'select_from_model' :
case 'int' : $field = array(
'type' => 'INT',
'constraint' => $data['length'] ? $data['length'] : 10 ,
) ;
break;
case 'float' : $field = array(
'type' => 'FLOAT',
'constraint' => $data['length'] ? $data['length'] : 10,
) ;
break;
case 'input' :
case 'select':
case 'radio' :
case 'checkbox':
case 'datetime':
case 'colorpicker':
case 'linked_menu':
case 'textarea' :
$field = array(
'type' => 'VARCHAR',
'constraint' => $data['length'] ? $data['length'] : 100 ,
) ;
break;
case 'wysiwyg' :
case 'FCK' : //这里返回TEXT设置//根据自己情况,为了明了可以重新case,我偷懒直接利用
case 'wysiwyg_basic':
$field = array(
'type' => 'TEXT',
) ;
break;
}
第六步:彻底更新缓存,成功!
实现效果如下:
|
评分
-
查看全部评分
|