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常用字符函数实例小结

本文实例总结了php常用字符函数。分享给大家供大家参考,具体如下: 1. string substr(string  $string, int $start &nbs...

使用PHP批量生成随机用户名

程序一:负责从字典中随机提取数据,写入一个新文件。(1.php) 复制代码 代码如下:<?php /* 从字典文件中提取随机值 */ $file1 =...

PHP实现表单提交数据的验证处理功能【防SQL注入和XSS攻击等】

本文实例讲述了PHP实现表单提交数据的验证处理功能。分享给大家供大家参考,具体如下: 防XSS攻击代码: /** * 安全过滤函数 * * @param $string *...

php下保存远程图片到本地的办法

今天在整理资料的时候发现以前找到的一个函数,通过这个函数我们就可以实现上面的功能。 主要函数: 复制代码 代码如下: function GrabImage($url,$filename=...

php使用str_replace替换多维数组的实现方法分析

本文实例讲述了php使用str_replace替换多维数组的实现方法。分享给大家供大家参考,具体如下: 在php中,如果使用str_replace替换数组中的字符串,只能替换一维的数组,...