首页技术文档Extjs › extjs fckeditor php 配置

extjs fckeditor php 配置

1.删除editor/_source 目录
这是FCKeditor的源码,可以删除

2. 删除editor/_source 目录,这是FCKeditor的源码,可以删除

3. 删除editor/lang 目录中除en/zh/zh-cn的语言文件

4. 删除editor/filemanage/connectors 除php的目录

5. 修改fckconfig.js

a) 默认语言FCKConfig.DefaultLanguage = ‘en’ ;个性为“zh-cn”

b) FCKConfig.FontNames = ‘Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana’ ;

在这里增加中文字体,修改为:

FCKConfig.FontNames = ‘宋体;黑体;隶书;楷体_GB2312;Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana’ ;

c) 修改服务端语言,将:

_FileBrowserLanguage

_QuickUploadLanguage

的值都改为“php”。

d) 更改表情图片。全部在:

FCKConfig.SmileyPath

FCKConfig.SmileyImages

FCKConfig.SmileyColumns

FCKConfig.SmileyWindowWidth

FCKConfig.SmileyWindowHeight

这几项中,请参照原值进行修改。

e) 自定义编辑器显示的工具栏及按钮

找到FCKConfig.ToolbarSets["Default"]这一段,并在里面选择所需要显示的按钮,不需要显示的删除掉。

6. 修改editor/filemanage/connectors/php/config.php。FCKeditor默认是关闭文件上传的,如果要打开, 必须修改这个文件。将$Config['Enabled'] = false ;改为“true”。

7. 修改文件上传路径

$Config['UserFilesPath'] = ‘/userfiles/’ ;

可以修改为以日期存放:

$Config['UserFilesPath'] = ‘/upload/’.date(“Y/m/d”).’/’;

注意,这个路径一定要以’/’结尾,否则上传图片时会出错。

8. 修改editor/filemanage/connectors/php/io.php

FCKeditor在上传文件是不对文件名进行重命名,这会影响到用中文名命名的文件,将SanitizeFileName函数改为如下内容:

$sExtension = substr( $sNewFileName, ( strrpos($sNewFileName, ‘.’) + 1 ) ) ;

$sNewFileName = date(“YmdHis_”).md5($sNewFileName.microtime()).’.’.$sExtension;

return $sNewFileName ;

9. FCKeditor在上传文件时出现的一些提示框为英文,为了方便使用,可以选择将这些提示汉化,如果不需要,可以忽略这一步

具体是修改以下文件:

editor/filemanage/connectors/php/commands.php

editor/filemanage/connectors/php/connector.php

editor/filemanage/connectors/php/upload.php

editor/dialog/fck_flash/fck_flash.js

editor/dialog/fck_image/fck_image.js

editor/dialog/fck_link/fck_link.js

====================

在PHP中这样使用:

<?php
include(“FCKeditor/fckeditor.php”);
$oFCKeditor = new FCKeditor(‘FCKeditor1′);//括号里的参数是$_POST[]中的KEY值
$oFCKeditor->BasePath = ‘/fckeditor/’;
$oFCKeditor->Value = ‘中华人民共和国’;
$oFCKeditor->Width = ’80%’; //注意属性的大小写
$oFCKeditor->Height = ’500′;
$oFCKeditor->Create();//或者 echo $oFCKeditor->CreateHTML();

?>

本站技术交流群:24735919,欢迎大家进群交流探讨!

发表评论