php下FCKeditor2.6.5網(wǎng)頁(yè)編輯器的使用方法
更新時(shí)間:2009年12月15日 12:28:41 作者:
php下FCKeditor2.6.5網(wǎng)頁(yè)編輯器的使用方法,需要的朋友可以參考下。
1、首先去官網(wǎng)下載FCKeditor2.6.5 多國(guó)語(yǔ)言版。http://ckeditor.com/download,注意:第一個(gè)為最新3.0.1版,第二個(gè)才是FCKeditor 2.6.5
2、刪除不必要的東西:
刪除/FCKeditor/目錄下除fckconfig.js,fckeditor.js,fckstyles.xml,fcktemplates.xml,fckeditor.php,fckeditor_php5.php,fckeditor_php4.php
七個(gè)文件以外的所有文件;
刪除目錄/editor/_source(基本上,所有_開(kāi)頭的文件夾或文件都是可選的);
刪除/editor/filemanager/connectors/下除了php目錄的所有目錄;
刪除/editor/lang/下的除了 en.js, zh.js, zh-cn.js三個(gè)文件的所有文件。
3、打開(kāi)/FCKeditor/fckconfig.js
修改
var FCKConfig.DefaultLanguage = 'zh-cn' ;
var _FileBrowserLanguage = 'php' ;
var _QuickUploadLanguage = 'php' ;
要開(kāi)啟文件上傳的話,還需要配置editor\filemanager\connectors\php\config.php
將$Config['Enabled'] = false ;改為$Config['Enabled'] = true ;
更改$Config['UserFilesPath'] = '/userfiles/' ;為你的上傳目錄;
4.調(diào)用方法(例子)
將FCKeditor放在網(wǎng)站根目錄
在PHP文件里面,包含/FCKeditor/fckeditor.php文件
//包含fckeditor類(lèi)
include("../FCKeditor/fckeditor.php") ;
//設(shè)置編輯器路徑
$sBasePath = "/FCKeditor/";
//創(chuàng)建一個(gè)Fckeditor,表單的txtarea名稱(chēng)為content
$oFCKeditor = new FCKeditor('content') ;
$oFCKeditor->BasePath = $sBasePath ;
//設(shè)置表單初始值
$oFCKeditor->Value = 'This is some <strong>sample text</strong>' ;
$oFCKeditor->Create() ;
//還可設(shè)置
$oFCKeditor->Width
$oFCKeditor->Height
$oFCKeditor->ToolbarSet
......................................................................................................................................................
<textarea name="content" style="display:none">這是文章內(nèi)容測(cè)試!</textarea>
<?php
include_once("fckeditor/fckeditor.php");
$oFCKeditor=new fckeditor('content');
$oFCKeditor->BasePath='fckeditor/';
$oFCKeditor->value='default text in editor';
$oFCKeditor->Width='800px';
$oFCKeditor->Height='300px';
$oFCKeditor->create();
//$fck=$oFCKeditor->CreateHtml();
?>
對(duì)于Fckeditor上傳中文名文件時(shí)顯示亂碼的問(wèn)題,現(xiàn)公布方法如下:
測(cè)試環(huán)境:php 5 , utf-8編碼
1、修正上傳中文文件時(shí)文件名亂碼問(wèn)題
在文件connectors/php/commands.php中查找:
$sFileName = $oFile['name'] ;
在后面添加一行:
$sFileName = iconv("utf-8","gbk",$sFileName);
2、修正文件列表時(shí)中文文件名顯示亂碼問(wèn)題
在文件connectors/php/util.php中查找:
return ( utf8_encode( htmlspecialchars( $value ) ) ) ;
修改為:
return iconv('','utf-8',htmlspecialchars( $value ));
3、修正新建中文文件夾時(shí)的文件夾名亂碼問(wèn)題
在文件connectors/php/commands.php中查找:
$sNewFolderName =
在后面添加一行:
$sNewFolderName = iconv("utf-8","gbk",$sNewFolderName);
2.6.3版及后續(xù)版本的fck下的html文件已經(jīng)加了utf-8的文件頭。
下面是一些補(bǔ)充
也許你經(jīng)常進(jìn)入網(wǎng)站的后臺(tái),或者發(fā)布文章什么的,你可以給你的文章添加不同的樣式,不同的字體,什么的,也許你會(huì)想這是怎么做的呢,其實(shí)這很簡(jiǎn)單,只需要用下fckeditor這個(gè)小插件就可以實(shí)現(xiàn),下面我們就看例子吧!
在fckeditor官方網(wǎng)站 上下載最新的源碼,http://ckeditor.com/download 下載最新的fckeditor 源碼包。
下載后就要配置了,源碼包里面有fckeditor/_samples這個(gè)文件,這里面有寫(xiě)好的例子,可以直接運(yùn)行,這樣的話,你就可以參考這樣的源文件,進(jìn)行改寫(xiě),需要注意的是,這里編輯器大部分都能用,上傳圖片卻不能用,
下面配置上傳圖片功能。
打開(kāi)文件FCKeditor/editor/filemanager/browser/default/connectors/php/config.php:
查找$Config['Enabled'],將它設(shè)置為'true';查找$Config['UserFilesPath'],將它設(shè)置圖片的目錄,這個(gè)目錄是相對(duì)于主目錄的。 也就是說(shuō),這個(gè)目錄是相對(duì)于根目錄的,注意,如果你在本機(jī)上測(cè)試,那么,這個(gè)根目錄就是 http://localhost ,
這樣基本配置已經(jīng)寫(xiě)好了,下面就是我寫(xiě)的一個(gè)小例子,index.php
<Form name="form1" method="post" action="index.php" target="_blank">
<?php
//引用FCKeditor.php這個(gè)文件,基本的類(lèi)和數(shù)據(jù)結(jié)構(gòu)都在這里
include("fckeditor/fckeditor.php") ;
?>
<input id="content" name="content" value="" type="hidden" /> <iframe id="content___Frame" frameborder="0" height="100%" scrolling="no" width="100%" src="/test/bianyiqi/fckeditor/editor/fckeditor.html?InstanceName=content&Toolbar=Default"> </iframe>
<input name ="haiyang" value="明天第一時(shí)間我會(huì)更好" type="text" />
<input type="submit" name="submit" value="提交" />
</Form>
<?php
echo stripslashes($_POST['content']);
echo "<br/>";
echo $_POST['haiyang'];
?>
直接測(cè)試即可 ,注意,index.php 和fckeditor是在同一級(jí)目錄下面的
2、刪除不必要的東西:
刪除/FCKeditor/目錄下除fckconfig.js,fckeditor.js,fckstyles.xml,fcktemplates.xml,fckeditor.php,fckeditor_php5.php,fckeditor_php4.php
七個(gè)文件以外的所有文件;
刪除目錄/editor/_source(基本上,所有_開(kāi)頭的文件夾或文件都是可選的);
刪除/editor/filemanager/connectors/下除了php目錄的所有目錄;
刪除/editor/lang/下的除了 en.js, zh.js, zh-cn.js三個(gè)文件的所有文件。
3、打開(kāi)/FCKeditor/fckconfig.js
修改
var FCKConfig.DefaultLanguage = 'zh-cn' ;
var _FileBrowserLanguage = 'php' ;
var _QuickUploadLanguage = 'php' ;
要開(kāi)啟文件上傳的話,還需要配置editor\filemanager\connectors\php\config.php
將$Config['Enabled'] = false ;改為$Config['Enabled'] = true ;
更改$Config['UserFilesPath'] = '/userfiles/' ;為你的上傳目錄;
4.調(diào)用方法(例子)
將FCKeditor放在網(wǎng)站根目錄
在PHP文件里面,包含/FCKeditor/fckeditor.php文件
復(fù)制代碼 代碼如下:
//包含fckeditor類(lèi)
include("../FCKeditor/fckeditor.php") ;
//設(shè)置編輯器路徑
$sBasePath = "/FCKeditor/";
//創(chuàng)建一個(gè)Fckeditor,表單的txtarea名稱(chēng)為content
$oFCKeditor = new FCKeditor('content') ;
$oFCKeditor->BasePath = $sBasePath ;
//設(shè)置表單初始值
$oFCKeditor->Value = 'This is some <strong>sample text</strong>' ;
$oFCKeditor->Create() ;
//還可設(shè)置
$oFCKeditor->Width
$oFCKeditor->Height
$oFCKeditor->ToolbarSet
......................................................................................................................................................
<textarea name="content" style="display:none">這是文章內(nèi)容測(cè)試!</textarea>
<?php
include_once("fckeditor/fckeditor.php");
$oFCKeditor=new fckeditor('content');
$oFCKeditor->BasePath='fckeditor/';
$oFCKeditor->value='default text in editor';
$oFCKeditor->Width='800px';
$oFCKeditor->Height='300px';
$oFCKeditor->create();
//$fck=$oFCKeditor->CreateHtml();
?>
對(duì)于Fckeditor上傳中文名文件時(shí)顯示亂碼的問(wèn)題,現(xiàn)公布方法如下:
測(cè)試環(huán)境:php 5 , utf-8編碼
1、修正上傳中文文件時(shí)文件名亂碼問(wèn)題
在文件connectors/php/commands.php中查找:
$sFileName = $oFile['name'] ;
在后面添加一行:
$sFileName = iconv("utf-8","gbk",$sFileName);
2、修正文件列表時(shí)中文文件名顯示亂碼問(wèn)題
在文件connectors/php/util.php中查找:
return ( utf8_encode( htmlspecialchars( $value ) ) ) ;
修改為:
return iconv('','utf-8',htmlspecialchars( $value ));
3、修正新建中文文件夾時(shí)的文件夾名亂碼問(wèn)題
在文件connectors/php/commands.php中查找:
$sNewFolderName =
在后面添加一行:
$sNewFolderName = iconv("utf-8","gbk",$sNewFolderName);
2.6.3版及后續(xù)版本的fck下的html文件已經(jīng)加了utf-8的文件頭。
下面是一些補(bǔ)充
也許你經(jīng)常進(jìn)入網(wǎng)站的后臺(tái),或者發(fā)布文章什么的,你可以給你的文章添加不同的樣式,不同的字體,什么的,也許你會(huì)想這是怎么做的呢,其實(shí)這很簡(jiǎn)單,只需要用下fckeditor這個(gè)小插件就可以實(shí)現(xiàn),下面我們就看例子吧!
在fckeditor官方網(wǎng)站 上下載最新的源碼,http://ckeditor.com/download 下載最新的fckeditor 源碼包。
下載后就要配置了,源碼包里面有fckeditor/_samples這個(gè)文件,這里面有寫(xiě)好的例子,可以直接運(yùn)行,這樣的話,你就可以參考這樣的源文件,進(jìn)行改寫(xiě),需要注意的是,這里編輯器大部分都能用,上傳圖片卻不能用,
下面配置上傳圖片功能。
打開(kāi)文件FCKeditor/editor/filemanager/browser/default/connectors/php/config.php:
查找$Config['Enabled'],將它設(shè)置為'true';查找$Config['UserFilesPath'],將它設(shè)置圖片的目錄,這個(gè)目錄是相對(duì)于主目錄的。 也就是說(shuō),這個(gè)目錄是相對(duì)于根目錄的,注意,如果你在本機(jī)上測(cè)試,那么,這個(gè)根目錄就是 http://localhost ,
這樣基本配置已經(jīng)寫(xiě)好了,下面就是我寫(xiě)的一個(gè)小例子,index.php
<Form name="form1" method="post" action="index.php" target="_blank">
<?php
//引用FCKeditor.php這個(gè)文件,基本的類(lèi)和數(shù)據(jù)結(jié)構(gòu)都在這里
include("fckeditor/fckeditor.php") ;
?>
<input id="content" name="content" value="" type="hidden" /> <iframe id="content___Frame" frameborder="0" height="100%" scrolling="no" width="100%" src="/test/bianyiqi/fckeditor/editor/fckeditor.html?InstanceName=content&Toolbar=Default"> </iframe>
<input name ="haiyang" value="明天第一時(shí)間我會(huì)更好" type="text" />
<input type="submit" name="submit" value="提交" />
</Form>
<?php
echo stripslashes($_POST['content']);
echo "<br/>";
echo $_POST['haiyang'];
?>
直接測(cè)試即可 ,注意,index.php 和fckeditor是在同一級(jí)目錄下面的
您可能感興趣的文章:
- PHP中CKEditor和CKFinder配置問(wèn)題小結(jié)
- 針對(duì)PHP環(huán)境下Fckeditor編輯器上傳圖片配置詳細(xì)教程
- 探討fckeditor在Php中的配置詳解
- fckeditor編輯器在php中的配置方法
- php下安裝配置fckeditor編輯器的方法
- php ckeditor上傳圖片文件名亂碼解決方法
- php fckeditor 調(diào)用的函數(shù)
- fckeditor在php中的用法(添加于修改寫(xiě)成了函數(shù))
- 將FCKeditor導(dǎo)入PHP+SMARTY的實(shí)現(xiàn)方法
- jQuery+PHP發(fā)布的內(nèi)容進(jìn)行無(wú)刷新分頁(yè)(Fckeditor)
- php版本CKEditor 4和CKFinder安裝及配置方法圖文教程
相關(guān)文章
百度UEditor修改右下角統(tǒng)計(jì)字?jǐn)?shù)包含html樣式
百度UEditor修改右下角統(tǒng)計(jì)字?jǐn)?shù)默認(rèn)只統(tǒng)計(jì)前臺(tái)所見(jiàn)的文字個(gè)數(shù),如何讓右下角統(tǒng)計(jì)字?jǐn)?shù)包含html樣式,需要的朋友可以參考下2014-07-07fckeditor編輯器下的自定義分頁(yè)符實(shí)現(xiàn)方法
今天在開(kāi)發(fā)后臺(tái)的時(shí)候需要用到自定義的分頁(yè)符,發(fā)現(xiàn)fckeditor編輯器下默認(rèn)的符號(hào)不好,dedecms也修改為自定義的,防止沖突2014-06-06FCKeditor 插件開(kāi)發(fā) 示例(詳細(xì)版本)
2009-06-06asp.net 為FCKeditor開(kāi)發(fā)代碼高亮插件實(shí)現(xiàn)代碼
昨天已經(jīng)將BlogEngine的可視化編輯器換成了FCKeditor,作為一個(gè)程序員,在博客中插入代碼是很重要的一塊。網(wǎng)上現(xiàn)有的都是修改FCKeditor的fckeditorcode_gecko.js和fckeditorcode_ie.js以達(dá)到InsertCode的目的。這個(gè)方法非常麻煩,當(dāng)要使用FCKeditor新版本時(shí)都要重新修改這兩個(gè)文件,非常影響我們的效率。2008-08-08ckeditor syntaxhighlighter代碼高亮插件,完美修復(fù)
昨天匆忙發(fā)了個(gè)更新版,今天去找ckeditor的api文檔看了很久,終于找到解決辦法了2011-08-08FCKEditor網(wǎng)頁(yè)編輯器 幾點(diǎn)使用心得
FCKEditor網(wǎng)頁(yè)編輯器 幾點(diǎn)使用心得,需要的朋友可以參考下。2009-10-10FCKEditor+jQuery+PHP實(shí)現(xiàn)分頁(yè)代碼
根據(jù)一下步驟,即可實(shí)現(xiàn)使用FCKEditor+jQuery+PHP實(shí)現(xiàn)無(wú)刷新頁(yè)面分頁(yè)。2010-07-07