在网站开发的过程中 一个好的文本编辑器在一般的CMS系统中是很重要的哦!发现现在用Fckeditor的比较多,这里我自己总结下 ,方便以后使用
Fckeditor 下载包 可以百度下 或者在优快云下载频道都有的,
下载后解压后会有两个文件夹和一些文件入口文件 为fckeditor.php
你在要调用Fckeditor的页面中 包含这个文件 就可以了
然后里面有些参数 需要说明下
$InstanceName 名字 这个是你在实例化这个类的时候需要传入的参数 用来区别于其他不同的实例,同时这个名字会是你提交表单的标签名
$BasePath 基本路径 就是你相对操作系统根目录的路径
$Width 宽度 可以是百分比或者px
$Height 高度 可以是百分比或者px
$ToolbarSet 工具条设置 这个是编辑器中 高级编辑 和简单编辑模式
$Value 默认的输入内容
$Config 配置信息 为数组 ARRAY 这个里面比较多
下面给一段我自己设置的代码 这个代码直接在HTML 表单中就OK 在接受页面中 例如
$oFCKeditor = new FCKeditor('Default') ; //
在接收页面 为 $_POST['Default'];接收
上代码:
<?php include("../../fckeditor.php") ; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>FCKeditor - Sample</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="robots" content="noindex, nofollow"> <link href="../sample.css" mce_href="sample.css" rel="stylesheet" type="text/css" /> </head> <body> <form action="default_recive.php" method="post" target="_blank"> <?php $sBasePath = $_SERVER['PHP_SELF'] ; $sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ; $oFCKeditor = new FCKeditor('Default') ; $oFCKeditor->BasePath = $sBasePath ; $oFCKeditor->Value = '' ; $oFCKeditor->Config['SkinPath'] = $sBasePath . 'editor/skins/silver/'; $oFCKeditor->Width = 500; $oFCKeditor->Height = 500; $oFCKeditor->Config['AutoDetectLanguage'] = false; $oFCKeditor->Config['DefaultLanguage'] = 'zh-cn' ; $oFCKeditor->Create() ; ?><br> <input type="submit" value="提交"> </form> </body> </html>
默认情况下 上传文件 是关闭的,如果开启的话 需要在配置文件中 设置 配置文件目录
fckeditor/editor/filemanager/connectors/php/config.php
$Config['Enabled'] = false ;
如果开启 设置为true 然后
$Config['UserFilesPath'] = '/userfiles/' ;
设置文件上传目录 至于更多的配置信息 例如上传类型 上传权限设置 等等 在此页面中可以找到
那个 就说道这里 详细的 依据个人的来。