php
$oFCKeditor = new FCKeditor('content') ;
$oFCKeditor-BasePath = 'fckeditor/' ;
$oFCKeditor-ToolbarSet = 'Default' ;
$oFCKeditor-InstanceName = 'content' ;
$oFCKeditor-Width = '100%' ;
$oFCKeditor-Value = '';
$oFCKeditor-Create() ;
FCKeditor 无需安装组件
配置细节如下:
说起 这个,更是郁闷,网上找了N篇资料,那是越看越迷糊啊,最后还是自己看代码搞定的.为了方便日后学习也小记一下吧.
②.、解压后为文件夹减肥:
删除/FCKeditor/目录下除fckconfig.js, fckeditor.js, fckstyles.xml, fcktemplates.xml,fckeditor.php五个文件以外的所有文件
删除目录/editor/_source,_testcases(基本上,所有_开头的文件夹或文件都是可选的),
删除/editor/filemanager/browser/default/connectors/下除PHP目录的所有目录
删除/editor/filemanager/browser/default/connectors/下除PHP目录的所有目录
删除/editor/filemanager/browser/default/connectors/下除PHP目录的所有目录
删除/editor/filemanager/upload/下的除PHP目录的所有目录
删除/editor/lang/下的除了 en.js, zh.js, zh-cn.js三个文件的所有文件
③
打开/FCKeditor/fckconfig.js
修改
var FCKConfig.DefaultLanguage = 'zh-cn' ;
var _FileBrowserLanguage = 'php' ;
var _QuickUploadLanguage = 'php' ;
要开启文件上传的话,还需要配置FCKeditor/editor/filemanager/upload/php/config.php以及/ FCKeditor/editor/filemanager/browser/default/connectors/php/config.php
要开启文件上传的话,还需要配置FCKeditor/editor/filemanager/upload/php/config.php以及/ FCKeditor/editor/filemanager/browser/default/connectors/php/config.php
要开启文件上传的话,还需要配置FCKeditor/editor/filemanager/upload/php/config.php以及/ FCKeditor/editor/filemanager/browser/default/connectors/php/config.php
(上传中文名文件会乱码)
④调用方法
将FCKeditor放在网站根目录
在PHP文件里面,包含/FCKeditor/fckeditor.php文件
//包含fckeditor类
include("../FCKeditor/fckeditor.php") ;
$sBasePath = "/FCKeditor/";
//创建一个Fckeditor,表单的名称为ipaddr
$oFCKeditor = new FCKeditor('ipaddr') ;
$oFCKeditor-BasePath = $sBasePath ;
//设置表单初始值
$oFCKeditor-Value = 'This is some strongsample text/strong' ;
//还可设置
$oFCKeditor-Width
$oFCKeditor-Height
$oFCKeditor-ToolbarSet
⑤定制
a.定制调用路径
直接将FCKeditor目录改为editor/,并且在调用的时候指定根路径为/editor/.
b.定制风格
可以通过修改editor/skins目录下的Skin来定制风格,主要是修改CSS.
c.定制toolbar
在fckconfig.js中,默认定制好了Default,Basic两种toolbar,你也可以根据格式定制自己的toolbar,并且在php中使用$oFCKeditor-ToolbarSet=toolbarname调用
d.定制字体
将fckconfig.js里面的FCKConfig.FontNames字体列表前面加上:
e.关闭文件上传
i. 将fckconfig.js里面的FCKConfig.LinkBrowser,FCKConfig.ImageBrowser, FCKConfig.FlashBrowser,FCKConfig.LinkUpload,FCKConfig.ImageUpload,FCKConfig.FlashUpload 设置为false.
ii.直接将filemanager里面的php文件删降
iii.定制toolbars
最重要的一点,你需要更改filemanager下面的php文件,只有认证的用户才可以访问.
在使用fckeditor 的过程中,经常需要根据实际需要来设置工具栏,显示或隐藏工具栏上的部分按钮.在默认情况下,fckeditor显示了全部的工具栏.在fckconfig.js中有两个工具栏的配置方案,一个是Default,一个是Basic.我们可以按照他的格式自定义几个选项.FCKConfig.ToolbarSets["c1"] = [
['Source','DocProps','-','Save','NewPage','Preview','-','Templates'],
['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
'/',
['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['Link','Unlink','Anchor'],
['Style','FontFormat','FontName','FontSize'],
['TextColor','BGColor'],
['FitWindow','ShowBlocks','-','About'] // No comma for the last row.
] ;在页面中使用fckeditor时可以写成这样var oFCKeditor = new FCKeditor( 'FCKeditor1' ) ;
oFCKeditor.ToolbarSet="c1";
$oFCKeditor-BasePath= $sBasePath;是这句错了.
改成$oFCKeditor-BasePath='fckeditor/' 就好了
你的$sBasePath只是取得了当前文件所在的目录,
这个$oFCKeditor-BasePath需要的是fck插件在系统中的路径,也就是fckeditor/这个文件夹.
function CreateEditor ($act,$id,$url) { #调用FCKeditor并补完发表文章的表单,act=0:发表新文章 =1修改文章
include("editor/fckeditor.php"); //FCKeditor已存放到此目录下
$oEditor = new FCKeditor ("content"); //对应于一个input控件,相当于是一个name=content的textarea
$oEditor - BasePath = 'editor/'; //配置基本信息
$oEditor - Width = "100%";
if( $act ) {
$query = "SELECT title,content FROM article WHERE id=$id";
$result = mysql_query($query);
$fillin = mysql_fetch_array($result);
}
echo 'form action="'.$url.'" method="post"';
echo 'pTitle: input type="text" class="text" class="text" name="title" size="100" value="'.$fillin['title'].'"/pp';
echo '/p';
echo 'pinput type="submit" class="button" value="P o s t"/p';
echo '/form';
CKEDITOR.editorConfig = function( config )
{config.filebrowserImageUploadUrl ='./static/ckeditor/upload.php?type=img';}路径可以根据情况自己修改,upload为你自己的上传类,具体的接受参数你可以从网上自己看看!!!
以上就是土嘎嘎小编为大家整理的phpfckeditor配置的简单介绍phpfckeditor配置的简单介绍相关咨询咨询主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!