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检查是否是ajax请求的方法

本文实例讲述了php检查是否是ajax请求的方法。分享给大家供大家参考。具体如下: 通过这段代码可以判断用户的请求是否来自AJAX XMLHttpRequest,以区别普通post,ge...

php简单实现查询数据库返回json数据

示例代码一: // 设置返回json格式数据 header('content-type:application/json;charset=utf8'); //连接数据库 $link...

eAccelerator的安装与使用详解

一、PHPeAccelerator安装去https://github.com/eaccelerator/eaccelerator/downloads下载最新版安装包,解压安装包,进入解压...

php和editplus正则表达式去除空白行

php和editplus正则表达式去除空白行

去除字符串内部的空行: 复制代码 代码如下: $str = preg_replace("/(\s*?\r?\n\s*?)+/","\n",$str); 去除全部...

PHP正则替换函数preg_replace和preg_replace_callback使用总结

在编写PHP模板引擎工具类时,以前常用的一个正则替换函数为 preg_replace(),加上正则修饰符 /e,就能够执行强大的回调函数,实现模板引擎编译(其实就是字符串替换)。 详情介...