參考一
首先到: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文件
<form action="./action.php" method="post" target="_blank">
<?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();
?>
<input type="submit" value="確定">
</form>
action.php文件
<?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引入在線編輯器時只需
<?php
include("fckeditor/fckeditor.php") ;
$oFCKeditor = new FCKeditor('FCKeditor1') ;//實例化
$oFCKeditor->BasePath = 'fckeditor/';//這個路徑一定要和上面那個引入路徑一致,否則會報錯:找不到fckeditor.html頁面
//$oFCKeditor->Value = '' ;
$oFCKeditor->Width = '100%' ;
$oFCKeditor->Height = '300' ;
$oFCKeditor->Create() ;
?>
JS用alert( FCKeditorAPI.GetInstance('FCKeditor1').GetXHTML( true ))得到FCKeditor1的值;
PHP用$_POST['FCKeditor1']得到FCKeditor1的值。
參考三
FCKeditor是sourceforge.net上面的一個開源項目,主要是實現在線網頁編輯器的功能,官方網站為http://www.fckeditor.net ,在服務器端支持ASP.Net、ASP、ClodFusion、PHP、Java等語言,并且支持IE 5+、Mozilla 、Netscape等主流瀏覽器。目前最新版本為2.0 Beta 2,但是目前2.0 Beta版還不支持PHP,所以這里我選擇使用了1.6版本。
首先我們先到http://sourceforge.net/projects/fckeditor/ 下載FCKeditor_1.6.zip,并將其解壓縮到你的網站子目錄里面,并將文件夾名改為FCKeditor。進入到FCKeditor/目錄下,打開_test/目錄,里面含有各種編程語言調用FCKeditor的方法,其中與PHP有關的文件有2個文件:
test.php //提交數據頁面
testsubmit.php //顯示數據頁面
大家可以看一下,了解FCKeditord的調用方法,下面是我簡寫了一個test程序:
<?php
if($_POST["ADD"]){
$Content=$_POST['EditorDefault'];
echo $Content;
//變量$Content就是我們在FCKeditord里面編輯的內容,這里可以將其保存到數據庫里面
}
?>
<html>
<head>
<?php
//引入在線編輯器
include("../FCKeditor/fckeditor.php") ;
?>
</head>
<body>
<br>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" language="javascript">
<?php
$oFCKeditor = new FCKeditor ;
// FCKeditor所在目錄,[b:91beb51adf]這個路徑一定要和上面那個引入路徑一致,否則會報錯:找不到fckeditor.html頁面[/b:91beb51adf]
$oFCKeditor->BasePath = '../FCKeditor/' ;
// 將FCKeditor實例化
$oFCKeditor->CreateFCKeditor( 'EditorDefault', '100%', 300 ) ;
?>
<INPUT type="submit" name="ADD" value="提交">
</form>
</body>
</html>
從上面的例子中我們可以看到要使用FCKeditor,首先要執行
include("../FCKeditor/fckeditor.php") ;語句來引用FCKeditor。然后執行
$oFCKeditor = new FCKeditor ;
$oFCKeditor->BasePath = '../FCKeditor/' ;
$oFCKeditor->CreateFCKeditor( 'EditorDefault', '100%', 300 ) ;
來實例化FCKeditor,如果是編輯頁面則再加入一行:
//$Content可以是從數據庫中讀取出來的數據
$oFCKeditor->Value = $Content ;
默認情況下,上傳圖片功能僅對應于ASP方式,要想實現在PHP下上傳文件,還得對FCKeditor的配置文件進行修改。打開/ FCKeditor/js/fck_config.js(這是FCKeditor的主配置文件),定位到文件的最下面那段被//注釋掉的內容,將
//##
//## Image Browsing
//##
config.ImageBrowser = true ;
// Custom Page URL
config.ImageBrowserURL = config.BasePath + "filemanager/browse/sample_html/browse.html" ;
//config.ImageBrowserURL = config.BasePath + "filemanager/browse/sample_php/browse.php" ;
//config.ImageBrowserURL = config.BasePath + "filemanager/browse/sample_jsp/browse.jsp?type=img" ;
//config.ImageBrowserURL = config.BasePath + "filemanager/browse/sample_asp/browse.asp" ;
//##
//## Image Upload
//##
config.ImageUpload = true ;
// Page that effectivelly upload the image.
config.ImageUploadURL = config.BasePath + "filemanager/upload/asp/upload.asp" ;
//config.ImageUploadURL = config.BasePath + "filemanager/upload/aspx/upload.aspx" ;
//config.ImageUploadURL = config.BasePath + "filemanager/upload/cfm/upload.cfm" ;
//config.ImageUploadURL = config.BasePath + "filemanager/upload/php/upload.php" ;
//config.ImageUploadURL = config.BasePath + "filemanager/upload/jsp/upload.jsp" ;
改為
//##
//## Image Browsing
//##
config.ImageBrowser = true ;
// Custom Page URL config.
ImageBrowserURL = "filemanager/browse/sample_html/browse.html" ;
config.ImageBrowserURL = config.BasePath + "filemanager/browse/sample_php/browse.php" ;
//##
//## Image Upload
//##
config.ImageUpload = true ;
// Page that effectivelly upload the image.
config.ImageUploadURL = config.BasePath + "filemanager/upload/php/upload.php" ;
最后再修改2個文件:
/FCKeditor/filemanager/upload/php/upload.php
第22行
$UPLOAD_BASE_URL = '/userimages/';
/FCKeditor/filemanager/browse/sample_php/browse.php
第20行
$IMAGES_BASE_URL = '/FCKeditor/userimages/';
這兩處定義了圖片上傳到哪個目錄,可以自行定義,不過一定要確保該目錄存在,不然上傳圖片時會報錯。
然后我們把FCKeditor目錄下的用不到的.asp、.jsp、. cfm文件和_test、_ aspnet、_developers、_docs、_jsp目錄都刪掉以節省空間。好啦,FCKeditor的基本使用方法就講到這里,大家感興趣的話可以到我的網站來看看效果:http://www.shaof.com 。
補充:
在FCKeditor官方的網站注明FCKeditor目前支持3種瀏覽器:IE5+,Mozilla and Netscape。但在實驗中發現使用IE5.0是不支持圖片上傳功能,只有將IE升級到5.5或者6.0才能支持圖片上傳功能。而對于剛出的Mozilla Firefox 1.0 RC1以及Mozilla1.6(Linux環境),則完全無法使用FCKeditor。
以下是使用IE5.0和IE6.0時的截圖。
FCKeditor截圖
使用IE5.0時,看不到“上傳”提示
SATAND 回復于:2004-10-31 17:28:06
粗讀了js文件,可擴展性還好但是功能有限
放棄,作為紀念品收藏
參考四
在線編輯器FCKeditor在PHP中的使用方法
在線編輯器FCKeditor在PHP中的使用方法 (轉帖)
原作者:tjyihui 出處: phpx.com
FCKeditor是sourceforge.net上面的一個開源項目,主要是實現在線網頁編輯器的功能,官方網站為http://www.fckeditor.net ,在服務器端支持ASP.Net、ASP、ClodFusion、PHP、Java等語言,并且支持IE 5+、Mozilla 、Netscape等主流瀏覽器。目前最新版本為2.0 Beta 2,但是目前2.0 Beta版還不支持PHP,所以這里我選擇使用了1.6版本。下面是FCKeditor的一個截圖:
首先我們先到http://sourceforge.net/projects/fckeditor/ 下載FCKeditor_1.6.zip,并將其解壓縮到你的網站子目錄里面,并將文件夾名改為FCKeditor。進入到FCKeditor/目錄下,打開_test/目錄,里面含有各種編程語言調用FCKeditor的方法,其中與PHP有關的文件有2個文件:
test.php //提交數據頁面
testsubmit.php //顯示數據頁面
大家可以看一下,了解FCKeditord的調用方法,下面是我簡寫了一個test程序:
<?php
if($_POST["ADD"]){
$Content=$_POST['EditorDefault'];
echo $Content;
//變量$Content就是我們在FCKeditord里面編輯的內容,這里可以將其保存到數據庫里面
}
?>
<html>
<head>
<?php
//引入在線編輯器
include("../FCKeditor/fckeditor.php") ;
?>
</head>
<body>
<br>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" language="javascript">
<?php
$oFCKeditor = new FCKeditor ;
// FCKeditor所在目錄
$oFCKeditor->BasePath = '../FCKeditor/' ;
// 將FCKeditor實例化
$oFCKeditor->CreateFCKeditor( 'EditorDefault', '100%', 300 ) ;
?>
<INPUT type="submit" name="ADD" value="提交">
</form>
</body>
</html>
從上面的例子中我們可以看到要使用FCKeditor,首先要執行
include("../FCKeditor/fckeditor.php") ;語句來引用FCKeditor。然后執行
$oFCKeditor = new FCKeditor ;
$oFCKeditor->BasePath = '../FCKeditor/' ;
$oFCKeditor->CreateFCKeditor( 'EditorDefault', '100%', 300 ) ;
來實例化FCKeditor,如果是編輯頁面則再加入一行:
//$Content可以是從數據庫中讀取出來的數據
$oFCKeditor->Value = $Content ;
默認情況下,上傳圖片功能僅對應于ASP方式,要想實現在PHP下上傳文件,還得對FCKeditor的配置文件進行修改。打開/ FCKeditor/js/fck_config.js(這是FCKeditor的主配置文件),定位到文件的最下面那段被//注釋掉的內容,將
//##
//## Image Browsing
//##
config.ImageBrowser = true ;
// Custom Page URL
config.ImageBrowserURL = config.BasePath + "filemanager/browse/sample_html/browse.html" ;
//config.ImageBrowserURL = config.BasePath + "filemanager/browse/sample_php/browse.php" ;
//config.ImageBrowserURL = config.BasePath + "filemanager/browse/sample_jsp/browse.jsp?type=img" ;
//config.ImageBrowserURL = config.BasePath + "filemanager/browse/sample_asp/browse.asp" ;
//##
//## Image Upload
//##
config.ImageUpload = true ;
// Page that effectivelly upload the image.
config.ImageUploadURL = config.BasePath + "filemanager/upload/asp/upload.asp" ;
//config.ImageUploadURL = config.BasePath + "filemanager/upload/aspx/upload.aspx" ;
//config.ImageUploadURL = config.BasePath + "filemanager/upload/cfm/upload.cfm" ;
//config.ImageUploadURL = config.BasePath + "filemanager/upload/php/upload.php" ;
//config.ImageUploadURL = config.BasePath + "filemanager/upload/jsp/upload.jsp" ;
改為
//##
//## Image Browsing
//##
config.ImageBrowser = true ;
// Custom Page URL config.
ImageBrowserURL = "filemanager/browse/sample_html/browse.html" ;
config.ImageBrowserURL = config.BasePath + "filemanager/browse/sample_php/browse.php" ;
//##
//## Image Upload
//##
config.ImageUpload = true ;
// Page that effectivelly upload the image.
config.ImageUploadURL = config.BasePath + "filemanager/upload/php/upload.php" ;
最后再修改2個文件:
/FCKeditor/filemanager/upload/php/upload.php
第22行
$UPLOAD_BASE_URL = '/userimages/';
/FCKeditor/filemanager/browse/sample_php/browse.php
第20行
$IMAGES_BASE_URL = '/FCKeditor/userimages/';
這兩處定義了圖片上傳到哪個目錄,可以自行定義,不過一定要確保該目錄存在,不然上傳圖片時會報錯。
然后我們把FCKeditor目錄下的用不到的.asp、.jsp、. cfm文件和_test、_ aspnet、_developers、_docs、_jsp目錄都刪掉以節省空間。好啦,FCKeditor的基本使用方法就講到這里,大家感興趣的話可以到我的網站來看看效果:http://www.shaof.com 。
參考五
FCKeditor是目前互聯網上最好的在線編輯器,功能強大,支持IE 5.5+ (Windows), Firefox 1.0+, Mozilla 1.3+ and Netscape 7.1+.瀏覽器,無平臺限制,能夠在Windows, Mac and Linux上正常運行,可以和多種WEB語言融合,如ASP.Net 、ASP、ColdFusion、PHP、Java、 Active-FoxPro、Lasso、Perl、Python,還有多語言支持,提供50多種語言包,是一種開源軟件。最新的版本是2.4.3,下載地址:http://www.fckeditor.net/download
FCKeditor作為一種支持多平臺,多語言的編輯器,下載之后就可以直接在程序或者網頁中使用。有時由于系統并不需要如此之多的功能,所以還是需要進行一些簡單的修改,配置更加適合自己的網站的個性編輯器。
一、優化FCKeditor文件夾和文件:
下載FCKeditor并解壓之后,會產生_samples和editor兩個文件夾和幾個文件,全部刪除以_開頭的文件夾和文件,因為這些都是FCKeditor的一些例子而已,可以學習一下,但上傳到網站服務器上就大可不必了,刪除。在根目錄下,還有幾個fckeditor.asp,fckeditor.php,fckeditor.js......等其它文件,這個就看你的網站服務器和網站需要什么程序語言,有PHP,ASP,PERL,.NET等,我選擇的是腳本配置文件fckeditor.js,還有三個文件fckconfig.js、fckstyles.xml、fcktemplates.xml是必需的文件,其它的可以全部刪除。
打開editor文件夾,進入lang文件夾,這里面是FCKeditor的語言包來的,一般國內選擇en.js和zh.js和zh-cn.js文件就可以了,加上必需的文件fcklanguagemanager.js(此文件是2.4版本以下必需的),其它的文件可以完全刪除。
之后打開editor/filemanager文件夾,如果不要求在上傳圖片或者文件的時候顯示服務器上的內容,可以選擇刪除filemanager文件夾下的brower文件夾。然后進入upload文件夾,里面是各種程序語言的上傳文件,選擇你需要的那個程序語言文件夾,其它的刪除。
進入editor/Plugins文件夾,如果你不需要這些額外的FCKeditor插件的話,把里面的文件夾全部刪除。
進入editor/skins文件夾,里面是編輯器的皮膚文件,default文件是默認的灰色面板的編輯器,Office2003和silver是另外加載的,看哪個好看就選擇哪個,然后其它的刪除。
另外,editor/dialog文件夾里是一些編輯器的對話框,如果選擇基本的一些功能的話,可以相應的選擇其文件,把其它的刪除也是可以的。
到這里,編輯器的文件夾優化基本OK了,精簡了許多,更加方便了服務器的上傳和使用。
二、FCKeditor的基本配置修改:
fckconfig.js是FCKeditor編輯器的配置文件,不涉及到工具按鈕的增加的話修改這里面的配置完全可以了。
下面列舉的是fckconfig.js里的配置選項:
AutoDetectLanguage=true/false 自動檢測語言
BaseHref="" _fcksavedurl="""" 相對鏈接的基地址
ContentLangDirection="ltr/rtl" 默認文字方向
ContextMenu=字符串數組,右鍵菜單的內容
CustomConfigurationsPath="" 自定義配置文件路徑和名稱
Debug=true/false 是否開啟調試功能,這樣,當調用FCKDebug.Output()時,會在調試窗中輸出內容
DefaultLanguage="" 缺省語言
EditorAreaCss="" 編輯區的樣式表文件
EnableSourceXHTML=true/false 為TRUE時,當由可視化界面切換到代碼頁時,把HTML處理成XHTML
EnableXHTML=true/false 是否允許使用XHTML取代HTML
FillEmptyBlocks=true/false 使用這個功能,可以將空的塊級元素用空格來替代
FontColors="" 設置顯示顏色拾取器時文字顏色列表
FontFormats="" 設置顯示在文字格式列表中的命名
FontNames="" 字體列表中的字體名
FontSizes="" 字體大小中的字號列表
ForcePasteAsPlainText=true/false 強制粘貼為純文本
ForceSimpleAmpersand=true/false 是否不把&符號轉換為XML實體
FormatIndentator="" 當在源碼格式下縮進代碼使用的字符
FormatOutput=true/false 當輸出內容時是否自動格式化代碼
FormatSource=true/false 在切換到代碼視圖時是否自動格式化代碼
FullPage=true/false 是否允許編輯整個HTML文件,還是僅允許編輯BODY間的內容
GeckoUseSPAN=true/false 是否允許SPAN標記代替B,I,U標記
IeSpellDownloadUrl=""下載拼寫檢查器的網址
ImageBrowser=true/false 是否允許瀏覽服務器功能
ImageBrowserURL="" 瀏覽服務器時運行的URL
ImageBrowserWindowHeight="" 圖像瀏覽器窗口高度
ImageBrowserWindowWidth="" 圖像瀏覽器窗口寬度
LinkBrowser=true/false 是否允許在插入鏈接時瀏覽服務器
LinkBrowserURL="" 插入鏈接時瀏覽服務器的URL
LinkBrowserWindowHeight=""鏈接目標瀏覽器窗口高度
LinkBrowserWindowWidth=""鏈接目標瀏覽器窗口寬度
Plugins=object 注冊插件
PluginsPath="" 插件文件夾
ShowBorders=true/false 合并邊框
SkinPath="" 皮膚文件夾位置
SmileyColumns=12 圖符窗列數
SmileyImages=字符數組 圖符窗中圖片文件名數組
SmileyPath="" 圖符文件夾路徑
SmileyWindowHeight 圖符窗口高度
SmileyWindowWidth 圖符窗口寬度
SpellChecker="ieSpell/Spellerpages" 設置拼寫檢查器
StartupFocus=true/false 開啟時FOCUS到編輯器
StylesXmlPath="" 設置定義CSS樣式列表的XML文件的位置
TabSpaces=4 TAB鍵產生的空格字符數
ToolBarCanCollapse=true/false 是否允許展開/折疊工具欄
ToolbarSets=object 允許使用TOOLBAR集合
ToolbarStartExpanded=true/false 開啟是TOOLBAR是否展開
UseBROnCarriageReturn=true/false 當回車時是產生BR標記還是P或者DIV標記
下面詳細的說明一下一些常用的配置選項:
FCKConfig.DefaultLanguage = 'en' ; //選擇編輯器的語言,editor/lang/文件夾下面的有相應的語言腳本文件。
FCKConfig.ToolbarStartExpanded = true ;//載入編輯器的時候展開還是收縮工具按鈕。
FCKConfig.ToolbarSets["Default"] 和 FCKConfig.ToolbarSets["Basic"]是載入的時候顯示全部工具按鈕還是部分基本按鈕。可以在fckeditor.js或者fckeditor.asp/php等文件中設置。
FCKConfig.ContextMenu這個是編輯器的右鍵配置文件,可以自己增減對應按鈕。
FCKConfig.LinkBrowser = false ;//瀏覽服務器上的文件,如果選擇false不允許的話,接下去的幾行可以相應的注釋掉。后面的FCKConfig.ImageBrowser = false ;FCKConfig.FlashBrowser = false ;也是如此。如果選擇允許的話,將相應的程序語言部分的注釋去掉。
FCKConfig.LinkUpload = true ;FCKConfig.ImageUpload = true ;FCKConfig.FlashUpload = true ;這三個配置選項是設置文件上傳的,如果不允許用戶上傳文件,則把true修改為false即可。如果允許,請在相應的程序語言里選擇,即把對應的注釋行去掉即可。
修改完畢之后再打開相應的程序語言的FCKeditor文件繼續。
三、修改編輯器載入時的配置:
打開fckeditor.js或者fckeditor.asp/php/pl等文件,這些文件的配置情況都是差不多的。這里拿fckeditor.js說明。
Width:編輯器寬度。
Height:編輯器高度。
ToolbarSet:編輯器工具按鈕:default或者basic。
BasePath:編輯器所在目錄,建議使用根目錄形式。
其它的就可以設置默認的就可以了。
四、使用FCKeditor編輯器:
1、ASP程序語言載入編輯器:
包含文件fckeditor.asp文件,然后在相應的地方加入下面的代碼:
<%
Dim oFCKeditor
Set oFCKeditor = New FCKeditor
oFCKeditor.BasePath = "/"
oFCKeditor.ToolbarSet = "Default"
oFCKeditor.Width = "100%"
oFCKeditor.Height = "400"
oFCKeditor.Value = rs("Content")
oFCKeditor.Create "Content"
%>
2、JS程序語言載入編輯器:
引用腳本fckeditor.js文件,在相應的地方加入下面的代碼:
<script type="text/javascript">
var oFCKeditor = new FCKeditor( 'Content' ) ;
oFCKeditor.BasePath = '/' ;
oFCKeditor.ToolbarSet = 'Basic' ;
oFCKeditor.Width = '100%' ;
oFCKeditor.Height = '400' ;
oFCKeditor.Value = '' ;
oFCKeditor.Create() ;
</script>
JS語言版本的還有一種替換文本框加快頁面顯示的文件,在這里我選擇的是點擊編輯框才出現編輯器,引用fckeditor.js文件,加入如下代碼:
<script type="text/javascript">
<!--
function ShowEditor() {
var oFCKeditor = new FCKeditor( 'Content' ) ;
oFCKeditor.BasePath = "../FCKeditor/" ;
oFCKeditor.Value = '' ;
oFCKeditor.ReplaceTextarea() ;
}
//-->
</script><div id="preContent"><textarea id="Content" onclick="javascript:ShowEditor();"></textarea></div>
3、PHP程序語言載入編輯器:
包含fckeditor.php文件,在相應的地方加入下面的代碼:
<?php
$oFCKeditor = new FCKeditor('Content') ;
$oFCKeditor->BasePath = "../FCKeditor/" ;
$oFCKeditor->Value = '' ;
$oFCKeditor->Create() ;
?>
新聞熱點
疑難解答