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
Zend studio for eclipse中使php可以调用mysql相关函数的设置方法
Oct 13 PHP
介绍一些PHP判断变量的函数
Apr 24 PHP
php pki加密技术(openssl)详解
Jul 01 PHP
php实现文件下载功能的几个代码分享
May 10 PHP
采用ThinkPHP中F方法实现快速缓存实例
Jun 13 PHP
php实现根据字符串生成对应数组的方法
Sep 22 PHP
php面象对象数据库操作类实例
Dec 02 PHP
对比PHP对MySQL的缓冲查询和无缓冲查询
Jul 01 PHP
php中时间函数date及常用的时间计算
May 12 PHP
php支付宝APP支付功能
Jul 29 PHP
在 Laravel 中动态隐藏 API 字段的方法
Oct 25 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
php页面缓存ob系列函数介绍
2012/10/18 PHP
PHP+Ajax实现的博客文章添加类别功能示例
2018/03/29 PHP
详解Laravel服务容器的绑定与解析
2019/11/05 PHP
一个很简单的jquery+xml+ajax的无刷新树结构(无css,后台是c#)
2010/06/02 Javascript
IE中JS跳转丢失referrer问题的2个解决方法
2014/07/18 Javascript
AngularJS中的模块详解
2015/01/29 Javascript
使用jquery组件qrcode生成二维码及应用指南
2015/02/22 Javascript
基于Jquery实现表单验证
2020/07/20 Javascript
JS+CSS实现大气的黑色首页导航菜单效果代码
2015/09/10 Javascript
深入浅析JavaScript中prototype和proto的关系
2015/11/15 Javascript
Javascript的表单验证长度
2016/03/16 Javascript
jquery获取复选框的值的简单实例
2016/05/26 Javascript
JavaScript实现倒计时跳转页面功能【实用】
2016/12/13 Javascript
使用vue-cli编写vue插件的方法
2018/02/26 Javascript
vue 微信授权登录解决方案
2018/04/10 Javascript
解决淘宝cnpm 安装后cnpm不是内部或外部命令的问题
2018/05/17 Javascript
微信小程序如何实现精确的日期时间选择器
2020/01/21 Javascript
jQuery HTML设置内容和属性操作实例分析
2020/05/20 jQuery
javascript实现拼图游戏
2021/01/29 Javascript
python根据出生日期获得年龄的方法
2015/03/31 Python
keras自定义回调函数查看训练的loss和accuracy方式
2020/05/23 Python
python 使用paramiko模块进行封装,远程操作linux主机的示例代码
2020/12/03 Python
HTML5 canvas基本绘图之文字渲染
2016/06/27 HTML / CSS
中国高端家电购物商城:顺电
2018/03/04 全球购物
运动服饰每月订阅盒:Ellie
2018/04/29 全球购物
Spotahome意大利:公寓和房间出租
2020/02/21 全球购物
大学生物业管理求职信
2013/10/24 职场文书
出纳担保书范文
2014/04/02 职场文书
2014年班主任自我评价范文
2014/04/23 职场文书
求职简历自荐信
2014/06/18 职场文书
护士节活动总结
2014/08/29 职场文书
爱护公共设施演讲稿
2014/09/13 职场文书
派出所班子党的群众路线对照检查材料思想汇报
2014/10/01 职场文书
中班下学期幼儿评语
2014/12/30 职场文书
董事长秘书岗位职责
2015/02/13 职场文书
观看焦裕禄观后感
2015/06/09 职场文书