`
xieye
  • 浏览: 809549 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

FCKeditor_2.6.3使用攻略for PHP

    博客分类:
  • PHP
阅读更多

FCKeditor_2.6.3使用攻略for PHP

感觉一个字:爽!

先从官网http://www.fckeditor.net/下载FCKeditor_2.6.3.zip
解压后把fckeditor整个目录放在文档根目录下
1、在项目根目录下建一个myconfig.js
2、在新的文件里填入内容(自己随意填吧,)
3、修改/fckeditor/fckconfig.js的内容的第一句。
FCKConfig.CustomConfigurationsPath = '' ;
修改为
FCKConfig.CustomConfigurationsPath = '/myconfig.js' ;
这样就加载了自定义配置文件。
注:这步也可以不做。



修改/fckeditor/editor/filemanager/connectors/php/config.php

1、最开始补一句。
session_start(); //允许会话

2、
$Config['Enabled'] = false ;
下面加一句
$Config['Enabled'] = true ;

3、注:这是相对于apache的文档根目录的
$Config['UserFilesPath'] = '/userfiles/' ;
下面加一句
$Config['UserFilesPath'] = '/temp/' ;

4、注:这是相对于硬盘目录的,且必须与上一条相符合
$Config['UserFilesAbsolutePath'] = '' ;
下面加一句
$Config['UserFilesAbsolutePath'] = 'd:\\www\\temp\\' ;

假定我的网站是windows,放在d:\www目录下,我想把用户上传的图象保存在
d:\\www\\temp\\下,对应的文档目录是/temp/

如果是linux,完全一样,自行修改
之所以用会话,原因不说也清楚,不可能把所有上传的图象放到同一目录下啊。
所以上面的语句3、4可以自行修改。


总之,就这两个文件一个js,一个php,
如果需限制图象文件的类型,需要在两个文件同时修改,自己看看吧,很简单的
可以在根目录下建一个test_fck.php文件自己测试
<?php
define('ROOT_PATH', './');
include_once( ROOT_PATH . "fckeditor/fckeditor.php") ; //php使用必须
?>
<html>
<head>
  <title>FCKeditor - Sample</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
  <form action="" method="post" target="_blank">
<?php
$oFCKeditor = new FCKeditor('content') ; //参数可能代表了表单元素的name,实际使用中我自己提交前用js强行赋值document.getElementById('content').value = FCKeditorAPI.GetInstance('content').GetXHTML();
$oFCKeditor->BasePath = '/fckeditor/' ; //这句话必须这样写
$oFCKeditor->Value = '<p> <a href="http://www.fckeditor.net/">FCKeditor</a>.</p>' ;//默认的值,正常都是写$oFCKeditor->Value = '';
$oFCKeditor->Height = 500 ; //高度
$oFCKeditor->Create() ;     //echo html代码
?>
    <br>
    <input type="submit" value="Submit">
  </form>
</body>
</html>


xieye:以上内容参照了官网的说明http://www.fckeditor.net/

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics