您现在的位置是:网站首页> 编程资料编程资料

FCKeditor2.3 For PHP 详细整理的使用参考_网页编辑器_

2023-05-25 173人已围观

简介 FCKeditor2.3 For PHP 详细整理的使用参考_网页编辑器_

参考一

首先到:http://www.fckeditor.net去下载FCKeditor
放到网站根目录。
精简说明:
删除所有"_"开头的文件和文件夹
删除语言包中除中文和英文以外的语言
删除skin目录下除默认皮肤以外的文件夹
filemanager/browser/default/connectors/目录下除php以外的文件
filemanager/upload/目录下除php以外的文件
表情文件夹及表情按钮

配置说明:
fckeditor.php :
BasePath为默认Fckeditor的目录,也可以在调用的时候指定.

fckconfig.js :
AutoDetectLanguage 建议关闭,在DefaultLanguage中手动指定默认语言:zh-cn.
ToolbarSets FCKeditor的功能按纽,可自行定制.
_FileBrowserLanguage,_QuickUploadLanguage 指定文件浏览及上传使用的语言,我指定php.

editor\filemanager\browser\default\connectors\php\config.php
editor\filemanager\upload\php\config.php
$Config['Enabled'] 是否允许上传
$Config['UserFilesPath'] 默认上传路径,可以更改但必须在相应的目录下建这个名称的目录。

配置 FCKeditor的toolbar功能按钮可以很容易地进行定制,你可以依据你的需要在FCKeditor的配置文件FCKeditor\fck_config.js中进行定制,增加类似config.ToolbarSets["name"] = [ ][ ]; (这里中括号里面的内容自定)使用时只需把$oFCKeditor->ToolbarSet = 'Default' 改为$oFCKeditor->ToolbarSet = 'name' 即可。

工具栏功能说明:

功能名称
含义
功能名称
含义
EditSource
显示HTML源代码
StrikeThrough
删除线
Save
保存
Subscript
下标
NewPage
新建空白页面
Superscript
上标
Preview
预览
JustifyLeft
左对齐
Cut
剪切
JustifyCenter
居中对齐
Copy
复制
JustifyRight
右对齐
Paste
粘贴
JustifyFull
两端对齐
PasteText
纯文本粘贴
InsertOrderedList
自动编号
PasteWord
来自Word的粘贴
InsertUnorderedList
项目符号
Print
打印
Outdent
减少缩进
SpellCheck
拼写检查
Indent
增加缩进
Find
查找
ShowTableBorders
显示表格线
Replace
替换
ShowDetails
显示明细
Undo
撤销
Form
添加Form动作
Redo
还原
Checkbox
复选框
SelectAll
全选
Radio
单选按钮
RemoveFormat
去除格式
Input
单行文本框
Link
插入/编辑 链接
Textarea
滚动文本框
RemoveLink
去除连接
Select
下拉菜单
Anchor
锚点
Button
按钮
Image
插入/编辑 图片
ImageButton
图片按钮
Table
插入/编辑 表格
Hidden
隐藏
Rule
插入水平线
Zoom
显示比例
SpecialChar
插入特殊字符
FontStyleAdv
系统字体
UniversalKey
软键盘
FontStyle
字体样式
Smiley
插入表情符号
FontFormat
字体格式
About
关于
Font
字体
Bold
粗体
FontSize
字体大小
Italic
斜体
TextColor
文字颜色
Underline
下划线
BGColor
背景色

使用方法:
test.php文件


include_once("FCKeditor/fckeditor.php");

   
$sBasePath = 'http://127.0.0.1/FCKeditor/';

   
$oFCKeditor = new FCKeditor('input');
   
$oFCKeditor->BasePath    = $sBasePath ;
   
$oFCKeditor->Width = '100%';
   
$oFCKeditor->Height = '100px';
    $ofCKeditor->ToolbarSet='Default'
;
   
$oFCKeditor->Value = 'Hello World!';
    echo
$oFCKeditor->CreateHtml();
?>


action.php文件
if ( isset( $_POST ) )
   $postArray = &$_POST ;  
foreach ( $postArray as $sForm =>$value )
{
$postedValue = htmlspecialchars( stripslashes( $value ) ) ;
echo $postedValue;
//另外的处理语句。
?>
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

参考二

PHP中使用FCKeditor2.3.2配置

FCKeditor2.3.2在线编辑器非常好用,完全支持文件上传。今天baidu了一下午终于搞定了。 下载FCKeditor2.3.2,解压至FCKeditor。
1首先删除不必要的文件节省空间。凡是以_开头的文件如_samples,_testcases和一些用不到的.asp、.jsp、.cfm文件统统干掉。
2修改fckconfig.js
FCKConfig.AutoDetectLanguage = true ;//是否自动检测语言
FCKConfig.DefaultLanguage  = 'zh-cn' ;//设置语言
FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/default/' ;//设置皮肤
FCKConfig.TabSpaces = 1 ;//tab是否有效
FCKConfig.ToolbarStartExpanded = true ;//编辑工具条是否出现,等点“展开工具栏”时才出现
FCKConfig.FontNames  = '宋体;黑体;隶书;楷体_GB2312;Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ;//添加中文字体

修改FCKeditor\editor\css\fck_editorarea.css
设置默认字体及大小
body, td
{
font-family: Arial, Verdana, Sans-Serif;
font-size: 14px;
}

3关于文件上传的设置

修改fckconfig.js
var _FileBrowserLanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php
var _QuickUploadLanguage = 'php' ; // asp | aspx | cfm | lasso | php

修改fckeditor\editor\filemanager\browser\default\connectors\php
$Config['Enabled'] = true ;
$Config['UserFilesPath'] = '/UserFiles/' ;//设置上传的文件夹,可自己指定

修改fckeditor\editor\filemanager\upload\php
$Config['Enabled'] = true ;
$Config['UseFileType'] = true ;
$Config['UserFilesPath'] = '/UserFiles/' ;//同上要一样

4引入在线编辑器时只需
include("fckeditor/fckeditor.php") ;
$oFCKeditor = new FCKeditor('FCKeditor1') ;//实例化
$oFCKeditor->BasePath = 'fckeditor/'

-六神源码网