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中养成7个面向对象的好习惯

在 PHP 编程早期,PHP 代码在本质上是限于面向过程的。过程代码 的特征在于使用过程构建应用程序块。过程通过允许过程之间的调用提供某种程度的重用。 但是,没有面向对象的语言构造,程序...

[PHP]实用函数10

//将IP点分地址的字符转化回IP v4格式地址 int ip2long(string ip_address) //将IP v4格式地址转化回IP...

PHP中的output_buffering详细介绍

我个人认为,Output buffering是比较纯粹的4.0特征。尽管从概念上看来相当简单,但是output buffering功能非常强大,能使开发者更容易地开发高级而有效的程序。...

解析PHP计算页面执行时间的实现代码

如下所示:复制代码 代码如下:<?php  $t = new executeTime;  phpinfo();  class executeTime{...

php启用sphinx全文搜索的实现方法

本文实例讲述了php启用sphinx全文搜索的实现方法。分享给大家供大家参考。具体分析如下: 在编译安装 sphinx 的时候出现很多中文乱码,最后抛出错误卡住了,我去到官方直接下载一个...