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中调用JAVA
Oct 09 PHP
php设计模式 Template (模板模式)
Jun 26 PHP
php缩放图片(根据宽高的等比例缩放)实例介绍
Jun 09 PHP
php 批量添加多行文本框textarea一行一个
Jun 03 PHP
Symfony页面的基本创建实例详解
Jan 26 PHP
php函数重载的替代方法--伪重载详解
May 08 PHP
深入浅析php json 格式控制
Dec 24 PHP
PHP实现原比例生成缩略图的方法
Feb 03 PHP
CI(CodeIgniter)框架实现图片上传的方法
Mar 24 PHP
php微信公众号开发之图片回复
Oct 20 PHP
PHP正则表达式笔记与实例详解
May 09 PHP
php设计模式之原型模式分析【星际争霸游戏案例】
Mar 23 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
全国FM电台频率大全 - 28 甘肃省
2020/03/11 无线电
如何使用FireFox插件FirePHP调试PHP
2013/07/23 PHP
PHP函数eval()介绍和使用示例
2014/08/20 PHP
PHP中file_get_contents高?用法实例
2014/09/24 PHP
PHP类的自动加载机制实现方法分析
2019/01/10 PHP
javascript在事件监听方面的兼容性小结
2010/04/07 Javascript
鼠标事件延时切换插件
2011/03/12 Javascript
js获取TreeView控件选中节点的Text和Value值的方法
2012/11/24 Javascript
jQuery中.live()方法的用法深入解析
2013/12/30 Javascript
JavaScript中的Array 对象(数组对象)
2016/06/02 Javascript
Javascript 普通函数和构造函数的区别
2016/11/05 Javascript
NodeJS整合银联网关支付(DEMO)
2016/11/09 NodeJs
vue+element-ui集成随机验证码+用户名+密码的form表单验证功能
2018/08/05 Javascript
vue新vue-cli3环境配置和模拟json数据的实例
2018/09/19 Javascript
详解为生产环境编译Angular2应用的方法
2018/12/10 Javascript
nodejs微信开发之授权登录+获取用户信息
2019/03/17 NodeJs
layui 图片上传+表单提交+ Spring MVC的实例
2019/09/21 Javascript
JS前后端实现身份证号验证代码解析
2020/07/23 Javascript
9种python web 程序的部署方式小结
2014/06/30 Python
python先序遍历二叉树问题
2017/11/10 Python
python3+pyqt5+itchat微信定时发送消息的方法
2019/02/20 Python
flask 实现上传图片并缩放作为头像的例子
2020/01/09 Python
PyCharm永久激活方式(推荐)
2020/09/22 Python
使用CSS3实现一个3D相册效果实例
2016/12/03 HTML / CSS
html5 input元素新特性_动力节点Java学院整理
2017/07/06 HTML / CSS
俄罗斯小米家用电器、电子产品和智能家居商店:Poood.ru
2020/04/03 全球购物
仓库班组长岗位职责
2013/12/12 职场文书
城建学院毕业生自荐信
2014/01/31 职场文书
小学数学国培感言
2014/03/10 职场文书
人力资源求职信
2014/05/25 职场文书
车间核算员岗位职责
2014/07/01 职场文书
企业安全生产目标责任书
2014/07/23 职场文书
读鲁迅先生的经典名言
2019/08/20 职场文书
Python OpenCV 图像平移的实现示例
2021/06/04 Python
选购到合适的激光打印机
2022/04/21 数码科技
Python TypeError: ‘float‘ object is not subscriptable错误解决
2022/12/24 Python