【摘 要】 在线编辑器2.0版确实比1.6版有了许多的改进。首先是FCKeditor的文件结构更加清晰,可以更方便地将其部署在自己的系统中。另外2.0版终于支持了Firefox 1.0浏览器,这将为FCKeditor赢得更多的使用者。
在线编辑器FCKeditor 2.0php环境下试用小记
一、简介
2004年11月30日推出了FCKeditor 2.0 RC1版,据其官方网站称:这是FCKeditor 2.0版的第一个稳定版本。大家现在可以考虑正式使用它了。目前支持的后台语言有ASP、asp.net、PHP和ColdFusion。
笔者在经过简单的试用发现,在线编辑器2.0版确实比1.6版有了许多的改进。首先是FCKeditor的文件结构更加清晰,可以更方便地将其部署在自己的系统中。另外2.0版终于支持了Firefox 1.0浏览器,这将为FCKeditor赢得更多的使用者。废话不多说,让我们赶快来学习如何安装、配置FCKeditor 2.0吧。
http://www.gaodaima.com/46600.html在PHP环境下配置在线编辑器FCKeditor_php
网站的结构如下:
/UserFiles //上传文件目录
/admin
test.php //提交数据页面
testsubmit.php //显示数据页面
进入到FCKeditor目录下,打开_samples目录,里面含有各种编程语言调用FCKeditor的范例程序页面,其中php目录中包含着一些使用PHP来调用FCKeditor的范例,大家可以看一下,了解FCKeditord的调用方法,下面是我简写了一个test.php程序,放在网站根目录下的admin目录中:
if($_POST[“ADD”]){
$Content=$_POST[‘EditorDefault’];
echo $Content;
//变量$Content就是我们在FCKeditord里面编辑的内容,这里可以将其保存到数据库,代码省略。
}
这里我们先看一下调用FCKeditor的函数,2.0版的调用方式与1.6版变化不大,如果你以前安装过FCKeditor 1.6,那么只需要修改很少的代码升级到2.0。
引用值
|
含义
|
InstanceName
|
实例化编辑器所需的唯一名称
|
Width
|
编辑器的宽度,单位为象素或者百分比(可选择的,默认为:100%)
|
Height
|
编辑器的高度,单位为象素或者百分比(可选择的,默认为:200)
|
ToolbarSet
|
工具栏的名称(可选择的,默认为:Default)
|
Value
|
编辑器的内容(HTML)初始值(可选择的)
|
$oFCKeditor->BasePath = ‘../FCKeditor/’ ;
$oFCKeditor->ToolbarSet = ‘Default’ ;
$oFCKeditor->InstanceName = ‘EditorDefault’ ;
$oFCKeditor->Width = ‘100%’ ;
$oFCKeditor->Height = ‘400’ ;
$oFCKeditor->Create() ;
//## Toolbar Buttons Sets
//##
FCKConfig.ToolbarSets[“Default”] = [
[‘Source’,’-‘,’Save’,’NewPage’,’Preview’],
[‘Cut’,’Copy’,’Paste’,’PasteText’,’PasteWord’,’-‘,’Print’],
[‘Undo’,’Redo’,’-‘,’Find’,’Replace’,’-‘,’SelectAll’,’RemoveFormat’],
[‘Bold’,’Italic’,’Underline’,’StrikeThrough’,’-‘,’Subscript’,’Superscript’],
[‘OrderedList’,’UnorderedList’,’-‘,’Outdent’,’Indent’],
[‘JustifyLeft’,’JustifyCenter’,’JustifyRight’,’JustifyFull’],
[‘Link’,’Unlink’],
[‘Image’,’Table’,’Rule’,’SpecialChar’,’Smiley’],
[‘Style’,’FontFormat’,’FontName’,’FontSize’],
[‘TextColor’,’BGColor’],
[‘About’]
] ;
2、简体中文设置
编辑edit/lang/fcklanguagemanager.js
将下面语句
{
‘ar’ : ‘Arabic’,
‘bs’ : ‘Bosnian’,
‘ca’ : ‘Catalan’,
‘en’ : ‘English’,
‘es’ : ‘Spanish’,
‘et’ : ‘Estonian’,
‘fi’ : ‘Finnish’,
‘fr’ : ‘French’,
‘gr’ : ‘Greek’,
‘he’ : ‘Hebrew’,
‘hr’ : ‘Croatian’,
‘it’ : ‘Italian’,
‘ko’ : ‘Korean’,
‘lt’ : ‘Lithuanian’,
‘no’ : ‘Norwegian’,
‘pl’ : ‘Polish’,
‘sr’ : ‘Serbian (Cyrillic)’,
‘sr-latn’ : ‘Serbian (Latin)’,
‘sv’ : ‘Swedish’
}
添加一行 ‘zh-cn’ : ‘Chinese’ 从而变成
{
‘ar’ : ‘Arabic’,
‘bs’ : ‘Bosnian’,
‘ca’ : ‘Catalan’,
‘en’ : ‘English’,
‘es’ : ‘Spanish’,
‘et’ : ‘Estonian’,
‘fi’ : ‘Finnish’,
‘fr’ : ‘French’,
‘gr’ : ‘Greek’,
‘he’ : ‘Hebrew’,
‘hr’ : ‘Croatian’,
‘it’ : ‘Italian’,
‘ko’ : ‘Korean’,
‘lt’ : ‘Lithuanian’,
‘no’ : ‘Norwegian’,
‘pl’ : ‘Polish’,
‘sr’ : ‘Serbian (Cyrillic)’,
‘sr-latn’ : ‘Serbian (Latin)’,
‘sv’ : ‘Swedish’,
‘zh-cn’ : ‘Chinese’
}
然后到这里http://www.shaof.com/download/zh-cn.js下载汉化好的zh-cn.js保存到editor/lang目录下即可。
FCKConfig.LinkBrowser = true ;
FCKConfig.LinkBrowserURL = FCKConfig.BasePath + “filemanager/browser/default/browser.html?Connector=connectors/php/connector.php” ;
FCKConfig.LinkBrowserWindowWidth = screen.width * 0.7 ; // 70%
FCKConfig.LinkBrowserWindowHeight = screen.height * 0.7 ; // 70%
//Image Browsing
FCKConfig.ImageBrowser = true ;
FCKConfig.ImageBrowserURL = FCKConfig.BasePath + “filemanager/browser/default/browser.html?Type=Image&Connector=connectors/php/connector.php” ;
FCKConfig.ImageBrowserWindowWidth = screen.width * 0.7 ; // 70% ;
FCKConfig.ImageBrowserWindowHeight = screen.height * 0.7 ; // 70% ;
FCKeditor/editor/filemanager/browser/default/connectors/php/connector.php // Get the “UserFiles” path. $GLOBALS[“UserFilesPath”] = ‘/UserFiles/’ ; |
另,遇到的问题
安装我文章里面的设置,上传路径设置为UserFiles/,但是上传图片文件时,FCKeditor都自动把文件上传到UserFiles/image目录下面,自做主张的建立了一个image目录,很是不爽。原因不明。
欢迎大家阅读《在PHP环境下配置在线编辑器FCKeditor_php》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码