search
Homephp教程PHP源码php在页面中调用fckeditor编辑器

fckeditor编辑器的代码可以写成一个函数或者类别,直接调用,不用每次都要写那么多代码!

刚才在论坛上看到一个童鞋分享的方法,感觉不是很全面,现在分享下我的! 

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[&#39;content&#39;];?>"> 
<IFRAME id="content" src="/fckeditor/editor/fckeditor.html?InstanceName=content&Toolbar=Normal" frameBorder=0 width=100% scrolling=no height=300 > 
</IFRAME>


Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor