php在页面中调用fckeditor编辑器的方法

yipeiwu_com6年前PHP代码库
刚才在论坛上看到一个童鞋分享的方法,感觉不是很全面,现在分享下我的!
复制代码 代码如下:

PHP页面:
/* 编辑器 */
include_once "../include/fckeditor/fckeditor.php";//把编辑器引进来
$editor = new FCKeditor('content');//表单项的名称
$editor->BasePath = "/fckeditor/";//编辑器所在目录
$editor->ToolbarSet = "Normal";//工具栏的名字,可以根据自己的需求加载其他的
$editor->Width = "95%";//宽度度
$editor->Height = "250";//高度
$editor->Value = $content;//初始值
$fckeditor = $editor->CreateHtml();//在要显示编缉器的地方输出变量$fckeditor的值就行了
$tpl->assign('fckeditor', $fckeditor);//模板赋值

HTML模板页面(我用的是smarty)
{%$fckeditor%}

一般php页面调用
content 是我定义的变量名
$content =$_POST["content"];
添加:
<INPUT name="content" id="content" type=hidden>
<IFRAME id="content" src="fckeditor/editor/fckeditor.html?InstanceName=content&Toolbar=Normal" frameBorder=0 width=100% scrolling=no height=300 ></IFRAME>
修改页面:
<INPUT name="content" id="content" type=hidden value="<?php echo $rows['content'];?>">
<IFRAME id="content" src="/fckeditor/editor/fckeditor.html?InstanceName=content&Toolbar=Normal" frameBorder=0 width=100% scrolling=no height=300 >
</IFRAME>

相关文章

php中http_build_query 的一个问题

当我们使用CURL来post数据的时候,需要设置post的数据 curl_setopt($c, CURLOPT_POSTFIELDS, $post_data); 假如这里的$data是...

实现dedecms全站URL静态化改造的代码

转自bbs.dedecms.com 1、将include复制到网站中的include目录。 2、修改数据库 将所有文档设置为“仅动态”,可以进入数据库管理中,执行下面命令: update...

php计算给定日期所在周的开始日期和结束日期示例

本文实例讲述了php计算给定日期所在周的开始日期和结束日期。分享给大家供大家参考,具体如下: <?php /** * 取得给定日期所在周的开始日期和结束日期 * @...

精通php的十大要点(上)

精通php的十大要点(上)

1. 在合适的时候使用PHP - Rasmus Lerdorf没有谁比PHP的创建者Rasmus Lerdorf明白PHP用在什么地方是更合理的, 他于1995年发布了PHP这门语言,从...

PHP合并数组函数array_merge用法分析

本文实例讲述了PHP合并数组函数array_merge用法。分享给大家供大家参考,具体如下: 合并数组是把一个数组追加到另一个数组中,主要应用array_merge()函数实现 语法如下...