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英文字母大小写转换函数小结

每个单词的首字母转换为大写:ucwords()复制代码 代码如下:<?php$foo = 'hello world!';$foo = ucwords($foo); &nb...

PHP数据对象映射模式实例分析

本文实例讲述了PHP数据对象映射模式。分享给大家供大家参考,具体如下: 将对象和数据存储映射起来,对一个对象的操作映射为对数据存储的操作。 例如在代码中new 一个对象,使用数组对象映射...

php表单提交实例讲解

php表单提交实例讲解

本文为大家分享了一个特别简单的php表单提交实例,具体的实现步骤如下: 实例代码如下: <form action="someform.php" method="post">...

PHP中file_exists与is_file,is_dir的区别介绍

很显然file_exists是受了asp的影响,因为asp不但有fileExists还有folderExists,driverExists,那么PHP中file_exists是什么意思呢...

php去除换行符的方法小结(PHP_EOL变量的使用)

一个小小的换行,其实在不同的平台有着不同的实现,为什么要这样,可以是世界是多样的。本来在unix世界换行就用/n来代替,但是windows为了体现他的不同,就用/r/n,更有意思的是在m...