<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[阿Tim日志]]></title> 
<link>https://atim.cn/index.php</link> 
<description><![CDATA[专业的php开发者.开发团队的带队人]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[阿Tim日志]]></copyright>
<item>
<link>https://atim.cn/post//</link>
<title><![CDATA[在线编辑器FCKeditor 2.0试用小记]]></title> 
<author>bkkkd &lt;partybase@gmail.com&gt;</author>
<category><![CDATA[开发应用]]></category>
<pubDate>Thu, 15 Dec 2005 07:39:28 +0000</pubDate> 
<guid>https://atim.cn/post//</guid> 
<description>
<![CDATA[ 
	<p><span style="FONT-SIZE: 13px"><b>一、简介</b><br />    2004年11月30日推出了FCKeditor 2.0 RC1版，据其官方网站称：这是FCKeditor 2.0版的第一个稳定版本。大家现在可以考虑正式使用它了。目前支持的后台语言有ASP、ASP.Net、PHP和ColdFusion。<br />    笔者在经过简单的试用发现，2.0版确实比1.6版有了许多的改进。首先是FCKeditor的文件结构更加清晰，可以更方便地将其部署在自己的系统中。另外2.0版终于支持了Firefox 1.0浏览器，这将为FCKeditor赢得更多的使用者。废话不多说，让我们赶快来学习如何安装、配置FCKeditor 2.0吧。<br /><b>二、安装与范例</b><br />    首先到<a href="http://sourceforge.net/projects/fckeditor/" target="_blank"><font color="#000000">http://sourceforge.net/projects/fckeditor/</font></a>下载FCKeditor 2.0 RC1（554K），并将其解压缩到你的网站目录里面，并将文件夹名改为FCKeditor。举例来说，如果你的网站放在shaof这个目录下面，则在这个目录中建立3个子目录：<br />        FCKeditor：存放从网站上下载的FCKeditor<br />        upimages：用于存放上传的图片<br />        admin：里面存放测试页面<br />网站的结构如下：<br />/shaof<br />          /FCKeditor           //FCKeditor目录<br />          /UserFiles            //上传文件目录<br />          /admin<br />                test.php          //提交数据页面<br />                testsubmit.php     //显示数据页面<br /><br />    进入到FCKeditor目录下，打开_samples目录，里面含有各种编程语言调用FCKeditor的范例程序页面，其中php目录中包含着一些使用PHP来调用FCKeditor的范例，大家可以看一下，了解FCKeditord的调用方法，下面是我简写了一个test.php程序，放在网站根目录下的admin目录中：<br />&lt;?php<br />if($_POST[&quot;ADD&quot;])&#123;        <br />        $Content=$_POST['EditorDefault'];<br />echo $Content;<br />//变量$Content就是我们在FCKeditord里面编辑的内容，这里可以将其保存到数据库，代码省略。<br />&#125;<br />?&gt;;<br />&lt;html&gt;;<br />&lt;head&gt;;<br />&lt;/head&gt;;<br />&lt;body&gt;;<br />&lt;form action=&quot;&lt;?php  echo $_SERVER['PHP_SELF'];  ?&gt;;&quot;  method=&quot;post&quot; language=&quot;javascript&quot;&gt;;<br />&lt;?php<br />//引入在线编辑器<br />include(&quot;../FCKeditor/fckeditor.php&quot;<img src="http://bbs.chinaunix.com/images/smilies/icon_wink.gif" align="absMiddle" border="0" /> ;<br /><br />    这里我们先看一下调用FCKeditor的函数，2.0版的调用方式与1.6版变化不大，如果你以前安装过FCKeditor 1.6，那么只需要修改很少的代码升级到2.0。<br />FCKeditor( instanceName[, width, height, toolbarSet, value] )<br />引用值                  含义<br />InstanceName        实例化编辑器所需的唯一名称<br />Width                        编辑器的宽度，单位为象素或者百分比（可选择的，默认为：100%）<br />Height                        编辑器的高度，单位为象素或者百分比（可选择的，默认为：200）<br />ToolbarSet        工具栏的名称（可选择的，默认为：Default）<br />Value                        编辑器的内容（HTML）初始值（可选择的）<br />好啦，下面就让我们利用这个函数来定制FCKeditor吧。<br /><br />$oFCKeditor = new FCKeditor('FCKeditor1')  ;<br />$oFCKeditor-&gt;;BasePath = '../FCKeditor/' ;        <br />$oFCKeditor-&gt;;ToolbarSet = 'Default' ;<br />$oFCKeditor-&gt;;InstanceName = 'EditorDefault' ;<br />$oFCKeditor-&gt;;Width = '100%' ;<br />$oFCKeditor-&gt;;Height = '400' ;<br />$oFCKeditor-&gt;;Create() ;<br />?&gt;;<br />&lt;INPUT type=&quot;submit&quot; name=&quot;ADD&quot; value=&quot;提交&quot;&gt;;<br />&lt;/form&gt;;<br />&lt;/body&gt;;<br />&lt;/html&gt;;<br /><br /><b>三、配置</b><br />FCKeditor 2.0的配置文件为FCKeditor\fckconfig.js，其中几个重要的配置项目如下：<br /><b>1、工具栏的设置</b><br />    默认情况下，FCKeditor会调用如下的工具栏按钮，大家可以根据自己的需要进行增减。需要注意的是，2.0版与1.6版的按钮并不完全相同，有些按钮以及删除或者改名了。<br />//##<br />//## Toolbar Buttons Sets<br />//##<br />FCKConfig.ToolbarSets[&quot;Default&quot;] = [<br />        ['Source','-','Save','NewPage','Preview'],<br />        ['Cut','Copy','Paste','PasteText','PasteWord','-','Print'],<br />        ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],<br />        ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],<br />        ['OrderedList','UnorderedList','-','Outdent','Indent'],<br />        ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],<br />        ['Link','Unlink'],<br />        ['Image','Table','Rule','SpecialChar','Smiley'],<br />        ['Style','FontFormat','FontName','FontSize'],<br />        ['TextColor','BGColor'],<br />        ['About']<br />] ;<br /><br /><b>2、简体中文设置</b><br />编辑edit/lang/fcklanguagemanager.js<br />将下面语句<br />FCKLanguageManager.AvailableLanguages = <br />&#123;<br />'ar'  : 'Arabic',<br />'bs'  : 'Bosnian',<br />'ca'  : 'Catalan',<br />'en'  : 'English',<br />'es'  : 'Spanish',<br />'et'  : 'Estonian',<br />'fi'  : 'Finnish',<br />'fr'  : 'French',<br />'gr'  : 'Greek',<br />'he'  : 'Hebrew',<br />'hr'  : 'Croatian',<br />'it'  : 'Italian',<br />'ko'  : 'Korean',<br />'lt'  : 'Lithuanian',<br />'no'  : 'Norwegian',<br />'pl'  : 'Polish',<br />'sr'  : 'Serbian (Cyrillic)',<br />'sr-latn' : 'Serbian (Latin)',<br />'sv'  : 'Swedish'<br />&#125;<br />添加一行 'zh-cn'    : 'Chinese' 从而变成<br />FCKLanguageManager.AvailableLanguages = <br />&#123;<br />'ar'  : 'Arabic',<br />'bs'  : 'Bosnian',<br />'ca'  : 'Catalan',<br />'en'  : 'English',<br />'es'  : 'Spanish',<br />'et'  : 'Estonian',<br />'fi'  : 'Finnish',<br />'fr'  : 'French',<br />'gr'  : 'Greek',<br />'he'  : 'Hebrew',<br />'hr'  : 'Croatian',<br />'it'  : 'Italian',<br />'ko'  : 'Korean',<br />'lt'  : 'Lithuanian',<br />'no'  : 'Norwegian',<br />'pl'  : 'Polish',<br />'sr'  : 'Serbian (Cyrillic)',<br />'sr-latn' : 'Serbian (Latin)',<br />'sv'  : 'Swedish',<br />'zh-cn'     : 'Chinese'<br />&#125;<br />    然后到这里http://www.shaof.com/download/zh-cn.js下载汉化好的zh-cn.js保存到editor/lang目录下即可。<br /><br /><b>四、设置文件上传</b><br />    FCKeditor 2.0采用了一种名为“Connector”（连接器）的技术来实现对文件的浏览以及上传。下图显示了文件浏览的工作流程图。<br /><br /><b>图1：Connector的工作流程图</b><br />    从图中可以看出，当客户端向服务器发出一个文件操作请求后，Connector就会对此请求进行响应，在服务器的文件系统中进行执行操作，如：文件和文件夹的浏览以及创建操作。最后将结果以XML的格式回应给客户端。具体的技术细节大家可以阅读FCKeditor自带的说明指南。<br />落实到应用，首先我们要选择一个后台语言用来实现这个功能，这里我们以PHP为例进行说明。<br />1、修改配置文件FCKeditor\fckconfig.js中的两段内容<br />//Link Browsing<br />FCKConfig.LinkBrowser = true ;<br />FCKConfig.LinkBrowserURL = FCKConfig.BasePath + &quot;filemanager/browser/default/browser.html?Connector=connectors/php/connector.php&quot; ;<br />FCKConfig.LinkBrowserWindowWidth        = screen.width * 0.7 ;        // 70%<br />FCKConfig.LinkBrowserWindowHeight        = screen.height * 0.7 ;        // 70%<br /><br />//Image Browsing<br />FCKConfig.ImageBrowser = true ;<br />FCKConfig.ImageBrowserURL = FCKConfig.BasePath + &quot;filemanager/browser/default/browser.html?Type=Image&amp;Connector=connectors/php/connector.php&quot; ;<br />FCKConfig.ImageBrowserWindowWidth  = screen.width * 0.7 ;        // 70% ;<br />FCKConfig.ImageBrowserWindowHeight = screen.height * 0.7 ;        // 70% ;<br /><br />2、修改配置文件FCKeditor\editor\filemanager\browser\default\connectors\php\connector.php<br />// Get the &quot;UserFiles&quot; path.<br />$GLOBALS[&quot;UserFilesPath&quot;] = '/UserFiles/' ;<br />UserFiles为文件上传的路径，与本文开头所给的例子相对应，大家可以自行修改。<br /><br />    好啦，只需要两步就完成了文件上传的配置工作，真是简单呀。以后我们通过FCKeditor上传的文件都会保存在网站的UserFiles目录下。<br /><br /><b>图2：FCKeditor2.0的文件管理截图</b><br /><br /><b>五、结束</b><br />    最后大家可以把FCKeditor目录下的_docs和_samples两个目录删除以节省空间。本文是笔者以前写过的一篇名为《在线编辑器FCKeditor在PHP中的使用方法》（1.6版）文章的升级版本，文章如有不妥之处，还请大家指正。</span> </p><p>原帖子：<a href="http://bbs.chinaunix.com/viewthread.php?tid=459239&extra=page%3D3%26filter%3Ddigest">http://bbs.chinaunix.com/viewthread.php?tid=459239&amp;extra=page%3D3%26filter%3Ddigest</a></p>
]]>
</description>
</item><item>
<link>https://atim.cn/post//#blogcomment</link>
<title><![CDATA[[评论] 在线编辑器FCKeditor 2.0试用小记]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://atim.cn/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>