Heim  >  Artikel  >  php教程  >  ThinkPHP示例:强大的Ueditor富文本编辑器

ThinkPHP示例:强大的Ueditor富文本编辑器

WBOY
WBOYOriginal
2016-06-07 11:44:521161Durchsuche

ThinkPHP示例:强大的Ueditor富文本编辑器
ThinkPHP示例:强大的Ueditor富文本编辑器


于2013-09-10更新版本:
Ueditor文本编辑器 - 完整demo
http://www.thinkphp.cn/code/325.html




具体插件下载:
http://ueditor.baidu.com/website/download.html#ueditor

解压到:PUBLIC/Ueditor下(同级目录有:Common,Conf,Lib,Tpl等)

例:在Tpl/model/model.html :<br> <title>Ueditor文本编辑器</title> <br> <br> <meta> <br> <load></load><br> <script><br /> window.UEDITOR_HOME_URL = "/ThinkPHP/Public/Ueditor/"; //UEDITOR_HOME_URL、config、all这三个顺序不能改变(绝对路径)<br /> </script><br> <load></load><br> <load></load><br> <br> <script><br /> var editor;<br /> <br /> function BeForeForm(formName){<br /> <br /> if(editor.hasContents()){ //此处以非空为例<br /> <br /> editor.sync(); //同步内容<br /> <br /> $("form[name=&#039;"+formName+"&#039;]").submit(); //提交表单判断,此方法是自己写的,不予给出,抱歉!只给提交方法!<br /> }<br /> }<br /> </script><br> 原本富文本域写法如下:

现在Ueditor支持div,script等标签 建议:script,因为这是官方文档的建议如:<br> <form> <br> <script></script><br> <script><br /> $(function(){<br /> var editor;<br /> //具体参数配置在 editor_config.js 中<br /> var options = {<br /> initialFrameWidth:1000, //初化宽度<br /> initialFrameHeight:300, //初化高度<br /> focus:false, //初始化时,是否让编辑器获得焦点true或false<br /> maximumWords:1000, //允许的最大字符数<br /> };<br /> editor = new UE.ui.Editor(options);<br /> editor.render("content");<br /> editor.ready(function(){<br /> editor.setContent(&#039;{$vo.content}&#039;); //加载数据库Action.class.PHP传过来的值<br /> });<br /> }); <br /> </script><br> <br> <input> <br> </form> <br> <br> 后台表单提交后的Action.class.php 原本ThinkPHP的写法存入数据库便可!可无需类似 $content = htmlspecialchars($_POST['content']); 该方法的转换
备注:content 字段是为 text 类型!

后台代码为:$direction = D("direction");  //包含 content 字段<br> $direction -> create();<br> $direction -> add();

AD:真正免费,域名+虚机+企业邮箱=0元

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:如何清除TP的文件缓存Nächster Artikel:TP去重统计查询