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

yipeiwu_com5年前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使用GD创建保持宽高比缩略图的方法

本文实例讲述了php使用GD创建保持宽高比缩略图的方法。分享给大家供大家参考。具体如下: /** * Create a thumbnail image from $inputFile...

PHP计算日期相差天数实例分析

本文实例分析了PHP计算日期相差天数的方法。分享给大家供大家参考,具体如下: <?PHP //今天与2016年10月27日相差多少天 $Date_1=date("Y-m...

PHP开发不能违背的安全规则 过滤用户输入

作为最基本的防范你需要注意你的外部提交,做好第一面安全机制处理防火墙。 规则 1:绝不要信任外部数据或输入 关于Web应用程序安全性,必须认识到的第一件事是不应该信任外部数据。外部数据(...

php基于curl实现的股票信息查询类实例

本文实例讲述了php基于curl实现的股票信息查询类。分享给大家供大家参考,具体如下: 股票信息查询功能我们是需要抓取第三方的数据,然后我们再把这些数据进行分析组成自己想要的,下面我们来...

php 格式化数字的时候注意数字的范围

构造sql语句是 比起来 复制代码 代码如下: $sql = 'SELECT * FROM sdb_comments WHERE goods_id = '.intval($goods_i...