国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 軟件應用 > 正文

php下FCKeditor2.6.5網頁編輯器的使用方法

2024-09-06 19:16:39
字體:
來源:轉載
供稿:網友
1、首先去官網下載FCKeditor2.6.5 多國語言版。http://ckeditor.com/download,注意:第一個為最新3.0.1版,第二個才是FCKeditor 2.6.5

2、刪除不必要的東西:

刪除/FCKeditor/目錄下除fckconfig.js,fckeditor.js,fckstyles.xml,fcktemplates.xml,fckeditor.php,fckeditor_php5.php,fckeditor_php4.php
七個文件以外的所有文件;
刪除目錄/editor/_source(基本上,所有_開頭的文件夾或文件都是可選的);
刪除/editor/filemanager/connectors/下除了php目錄的所有目錄;
刪除/editor/lang/下的除了 en.js, zh.js, zh-cn.js三個文件的所有文件。

3、打開/FCKeditor/fckconfig.js
修改
var FCKConfig.DefaultLanguage = 'zh-cn' ;
var _FileBrowserLanguage = 'php' ;
var _QuickUploadLanguage = 'php' ;
要開啟文件上傳的話,還需要配置editor/filemanager/connectors/php/config.php
將$Config['Enabled'] = false ;改為$Config['Enabled'] = true ;
更改$Config['UserFilesPath'] = '/userfiles/' ;為你的上傳目錄;

4.調用方法(例子)
將FCKeditor放在網站根目錄
在PHP文件里面,包含/FCKeditor/fckeditor.php文件
復制代碼 代碼如下:

//包含fckeditor類
include("../FCKeditor/fckeditor.php") ;
//設置編輯器路徑
$sBasePath = "/FCKeditor/";
//創建一個Fckeditor,表單的txtarea名稱為content
$oFCKeditor = new FCKeditor('content') ;
$oFCKeditor->BasePath = $sBasePath ;
//設置表單初始值
$oFCKeditor->Value = 'This is some <strong>sample text</strong>' ;
$oFCKeditor->Create() ;

//還可設置
$oFCKeditor->Width
$oFCKeditor->Height
$oFCKeditor->ToolbarSet
......................................................................................................................................................
<textarea name="content" style="display:none">這是文章內容測試!</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();
?>


對于Fckeditor上傳中文名文件時顯示亂碼的問題,現公布方法如下:
測試環境:php 5 , utf-8編碼

1、修正上傳中文文件時文件名亂碼問題
在文件connectors/php/commands.php中查找:
$sFileName = $oFile['name'] ;
在后面添加一行:
$sFileName = iconv("utf-8","gbk",$sFileName);

2、修正文件列表時中文文件名顯示亂碼問題
在文件connectors/php/util.php中查找:
return ( utf8_encode( htmlspecialchars( $value ) ) ) ;
修改為:
return iconv('','utf-8',htmlspecialchars( $value ));

3、修正新建中文文件夾時的文件夾名亂碼問題
在文件connectors/php/commands.php中查找:
$sNewFolderName =
在后面添加一行:
$sNewFolderName = iconv("utf-8","gbk",$sNewFolderName);

2.6.3版及后續版本的fck下的html文件已經加了utf-8的文件頭。

下面是一些補充
也許你經常進入網站的后臺,或者發布文章什么的,你可以給你的文章添加不同的樣式,不同的字體,什么的,也許你會想這是怎么做的呢,其實這很簡單,只需要用下fckeditor這個小插件就可以實現,下面我們就看例子吧!
在fckeditor官方網站 上下載最新的源碼,http://ckeditor.com/download 下載最新的fckeditor 源碼包。
下載后就要配置了,源碼包里面有fckeditor/_samples這個文件,這里面有寫好的例子,可以直接運行,這樣的話,你就可以參考這樣的源文件,進行改寫,需要注意的是,這里編輯器大部分都能用,上傳圖片卻不能用,
下面配置上傳圖片功能。

打開文件FCKeditor/editor/filemanager/browser/default/connectors/php/config.php:
查找$Config['Enabled'],將它設置為'true';查找$Config['UserFilesPath'],將它設置圖片的目錄,這個目錄是相對于主目錄的。 也就是說,這個目錄是相對于根目錄的,注意,如果你在本機上測試,那么,這個根目錄就是 http://localhost ,

這樣基本配置已經寫好了,下面就是我寫的一個小例子,index.php

<Form name="form1" method="post" action="index.php" target="_blank">
<?php
//引用FCKeditor.php這個文件,基本的類和數據結構都在這里
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&amp;Toolbar=Default"> </iframe>
<input name ="haiyang" value="明天第一時間我會更好" type="text" />
<input type="submit" name="submit" value="提交" />
</Form>

<?php
echo stripslashes($_POST['content']);
echo "<br/>";
echo $_POST['haiyang'];
?>
直接測試即可 ,注意,index.php 和fckeditor是在同一級目錄下面的
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 汪清县| 乳源| 尚义县| 陇川县| 青浦区| 兰坪| 高邑县| 左权县| 舒兰市| 吉安市| 古浪县| 保康县| 山阳县| 浑源县| 平阳县| 海晏县| 岳池县| 连云港市| 洞口县| 广元市| 松江区| 安吉县| 广河县| 韶关市| 庆元县| 谢通门县| 古蔺县| 永宁县| 安平县| 蒙阴县| 乡城县| 潮州市| 中西区| 平凉市| 晋宁县| 将乐县| 万盛区| 涡阳县| 盐山县| 洪江市| 英吉沙县|