FCKeditor_2.6.3使用攻略for 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/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值