Smarty中调用FCKeditor的方法


Posted in PHP onOctober 27, 2014

本文实例讲述了Smarty中调用FCKeditor的方法,分享给大家供大家参考。具体实现方法如下:

FCKeditor是目前互联网上最好的在线编辑器。

smarty是一个使用PHP写出来的模板PHP模板引擎,它提供了逻辑与外在内容的分离,简单的讲,目的就是要使用PHP程序员同美工分离,使用的程序 员改变程序的逻辑内容不会影响到美工的页面设计,美工重新修改页面不会影响到程序的程序逻辑,这在多人合作的项目中显的尤为重要。

在Smarty中调用FCKeditor的文件:

require_once("conn.php");  

require_once("class/Smarty.class.php");  

  

$smarty = new Smarty();  

$smarty->template_dir = "../templates";  

$smarty->compile_dir  = "../templates_c";  

$smarty->left_delimiter = "<{";  

$smarty->right_delimiter = "}>";  

  

$editor = new FCKeditor("Content") ;  

$editor->BasePath   = "../FCKeditor/";  

$editor->ToolbarSet = "Basic";  

$editor->Value      = "";  

$FCKeditor = $editor->CreateHtml();  

  

$smarty->assign('Title',"Rossy is here waiting for you");  

$smarty->assign('FCKeditor',$FCKeditor);    

$smarty->display('template.tpl');

但是运用这一种方法在编辑资料的时候竟然FCKeditor传不了值,只是生成了一个空值的编辑器,所以只能换一种方法:

require_once("conn.php");  

require_once("class/Smarty.class.php");  

   

$smarty = new Smarty();  

$smarty->template_dir = "../templates";  

$smarty->compile_dir  = "../templates_c";  

$smarty->left_delimiter = "<{";  

$smarty->right_delimiter = "}>";  

  

$editor = new FCKeditor("Content") ;  

$editor->BasePath   = "../FCKeditor/";  

$editor->ToolbarSet = "Basic";  

$editor->Value      = "Here is a example of smarty and FCKeditor";  

  

$smarty->assign('Title',"Rossy is here waiting for you");  

$smartyl->assign_by_ref("FCKeditor",$editor);  

$smarty->display('template.tpl');

模板文件template.tpl:

<htm>  

<head>  

<title>example of smarty use fckeditor</title>  

</head>  

  

<body>  

<P>Example</p>  

<p>title:<{$Title}></p>  

<p></p>  

<p>content:</p>  

<p><{$FCKeditor}></p>  

</body>  

</html>

希望本文所述对大家的PHP程序设计有所帮助。

PHP 相关文章推荐
开发大型PHP项目的方法
Oct 09 PHP
PHP 编写大型网站问题集
May 07 PHP
一篇有意思的技术文章php介绍篇
Oct 26 PHP
支付宝接口开发集成支付环境小结
Mar 17 PHP
Symfony2 session用法实例分析
Feb 04 PHP
PHP的PDO常用类库实例分析
Apr 07 PHP
php+html5+ajax实现上传图片的方法
May 14 PHP
thinkphp表单上传文件并将文件路径保存到数据库中
Jul 28 PHP
Ajax实现对静态页面的文章访问统计功能示例
Oct 10 PHP
php中让人头疼的浮点数运算分析
Oct 10 PHP
PHP 匿名函数与注意事项详细介绍
Nov 26 PHP
PHP钩子与简单分发方式实例分析
Sep 04 PHP
smarty简单分页的实现方法
Oct 27 #PHP
smarty半小时快速上手入门教程
Oct 27 #PHP
php命令行用法入门实例教程
Oct 27 #PHP
php基于mcrypt的加密解密实例
Oct 27 #PHP
CI框架学习笔记(二) -入口文件index.php
Oct 27 #PHP
PHP改进计算字符串相似度的函数similar_text()、levenshtein()
Oct 27 #PHP
CI框架学习笔记(一) - 环境安装、基本术语和框架流程
Oct 26 #PHP
You might like
DW中链接mysql数据库时,建立字符集中文出现乱码的解决方法
2010/03/27 PHP
Erlang的运算符(比较运算符,数值运算符,移位运算符,逻辑运算符)
2012/07/23 PHP
Laravel 5框架学习之Eloquent (laravel 的ORM)
2015/04/08 PHP
详解PHP错误日志的获取方法
2015/07/20 PHP
php使用ffmpeg向视频中添加文字字幕的实现方法
2016/05/23 PHP
PHP基于DOMDocument解析和生成xml的方法分析
2017/07/17 PHP
tp5框架的增删改查操作示例
2019/10/31 PHP
Gambit vs ForZe BO3 第二场 2.13
2021/03/10 DOTA
javascript中的float运算精度实例分析
2010/08/21 Javascript
jquery获取自定义属性(attr和prop)实例介绍
2013/04/21 Javascript
jquery网页元素拖拽插件效果及实现
2013/08/05 Javascript
JQuery判断radio(单选框)是否选中和获取选中值方法总结
2015/04/15 Javascript
简介JavaScript中fixed()方法的使用
2015/06/08 Javascript
JQuery.validate在ie8下不支持的快速解决方法
2016/05/18 Javascript
利用CSS、JavaScript及Ajax实现图片预加载的方法
2016/11/29 Javascript
Bootstrap基本插件学习笔记之折叠(22)
2016/12/08 Javascript
JS与HTML结合实现流程进度展示条思路详解
2017/09/03 Javascript
vue-cli 首屏加载优化问题
2018/11/06 Javascript
vue-cli3中vue.config.js配置教程详解
2019/05/29 Javascript
express如何解决ajax跨域访问session失效问题详解
2019/06/20 Javascript
微信小程序实现比较功能的方法汇总(五种方法)
2020/03/07 Javascript
[01:51]2018年度CS GO最具人气外援-完美盛典
2018/12/16 DOTA
Python3处理文件中每个词的方法
2015/05/22 Python
详解Python中最难理解的点-装饰器
2017/04/03 Python
基于python的selenium两种文件上传操作实现详解
2019/09/19 Python
CSS3制作轮播图的一种方法
2019/11/11 HTML / CSS
法国发饰品牌:Alexandre De Paris
2018/12/04 全球购物
武汉瑞得软件笔试题
2015/10/27 面试题
企业承诺书格式
2014/05/21 职场文书
二人合伙经营协议书
2014/09/13 职场文书
党员查摆四风问题思想汇报
2014/10/25 职场文书
今日说法观后感
2015/06/08 职场文书
2015年小学总务工作总结
2015/07/21 职场文书
详解python的内存分配机制
2021/05/10 Python
python3.7.2 tkinter entry框限定输入数字的操作
2021/05/22 Python
JS 4个超级实用的小技巧 提升开发效率
2021/10/05 Javascript