fckconfig.js中
改字体
FCKConfig.FontNames = Arial;宋体;黑体;隶书;楷体_GB2312;Times New Roman ;
改字体大小
FCKConfig.FontSizes = 16px/小;20px/大 ;
按照上面的自己写字体大小, 例如: 18px/中;
图片上传重名的问题,这样可以支持中文名字的图片:
fckeditor\editor\filemanager\connectors\php 下的 commands.php
找到
while ( true )
{
$sFilePath = $sServerDir . $sFileName ;
改成这样的
while ( true )
{
$sFileName = time() . _ . rand(10000, 99999) . . . $sExtension;
//可样就可以重命名了
$sFilePath = $sServerDir . $sFileName ;
精简后我的:
FCKConfig.ToolbarSets["Default"] = [
[Bold,Italic,Underline],
[JustifyLeft,JustifyCenter,JustifyRight,JustifyFull],
[Link,Unlink],
[Image,Table,PasteWord],
/,
[FontName,FontSize],
[TextColor,Preview],
// No comma for the last row.
] ;
fckeditor提供的包里面有不少例子,里面有php,jsp,asp,什么的,我的是php,只看php
按照里面的几个例子,修改了一下,如果想用 fckedit,首先引进
include("path/fckeditor/fckeditor.php") ;
文件路径自己找了
<?php
$oFCKeditor = new FCKeditor(fck) ;
$oFCKeditor->BasePath = path/fckeditor/ ;
$oFCKeditor->Width=80%;
$oFCKeditor->Height= 500;
$oFCKeditor->Create() ;
?>
上面的 fck是名字,如果fckeditor里面有值,用 $_POST[fck],或者$_GET[fck]就可以取值了
顺便说一下,取值这样取
if ( get_magic_quotes_gpc() ) {
$fck_value = htmlspecialchars(stripcslashes($_POST[fck]));
} else {
$fck_value = htmlspecialchars($_POST[fck]);
}
从数据库取值的时候
htmlspecialchars_decode($mysql_fck_vaule);
上传
fckeditor\editor\filemanager\connectors\php 下的 config.php
找到 $Config[Enabled] 后面设为 true
$Config[UserFilesPath] 后面设为自己的文件夹
这里我这样写的,可以每天产生一个文件夹,把图片上传到这个文件夹的
$NEWPATH = /fckedit/picture/ ;
$dateFile = date(Y_m_d, time());
if (!is_dir("$NEWPATH/$dateFile")) {
mkdir("$NEWPATH/$dateFile", 0777);
}
$Config[UserFilesPath] = "$NEWPATH/$dateFile/";
关于可以浏览服务的问题,如果是后台自己用,可以不用管,如果给用户用的话,在 fckeditor目录下找到
fckconfig.js
FCKConfig.LinkBrowser = true ;
FCKConfig.ImageBrowser = true ;
FCKConfig.FlashBrowser = true ;
后面三个 true改为 false;