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 Header用于页面跳转要注意的几个问题总结
Oct 03 PHP
PHPMailer安装方法及简单实例
Nov 25 PHP
php比较两个绝对时间的大小
Jan 31 PHP
PHP常用的缓存技术汇总
May 05 PHP
PHP针对常规模板引擎中与CSS/JSON冲突的解决方法
Aug 19 PHP
PHP 实现判断用户是否手机访问
Jan 21 PHP
php清除和销毁session的方法分析
Mar 19 PHP
让你的PHP7更快之Hugepage用法分析
May 31 PHP
php使用Jpgraph创建柱状图展示年度收支表效果示例
Feb 15 PHP
PHP基于自定义函数实现的汉字转拼音功能实例
Sep 30 PHP
Yii框架日志记录Logging操作示例
Jul 12 PHP
imagettftext() 失效,不起作用
Mar 09 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
实现分十页分向前十页向后十页的处理
2006/10/09 PHP
PHP-Fcgi下PHP的执行时间设置方法
2013/08/02 PHP
遭遇php的in_array低性能问题
2013/09/17 PHP
php session实现多级目录存放实现代码
2016/02/03 PHP
浅析Yii2 GridView 日期格式化并实现日期可搜索教程
2016/04/22 PHP
PHP检测一个数组有没有定义的方法步骤
2019/07/20 PHP
出现“不能执行已释放的Script代码”错误的原因及解决办法
2007/08/29 Javascript
javascript+iframe 实现无刷新载入整页的代码
2010/03/17 Javascript
JS实现在Repeater控件中创建可隐藏区域的代码
2010/09/16 Javascript
js二维数组定义和初始化的三种方法总结
2014/03/03 Javascript
解决jQuery上传插件Uploadify出现Http Error 302错误的方法
2015/12/18 Javascript
jQuery简单设置文本框回车事件的方法
2016/08/01 Javascript
BootStrap Table 分页后重新搜索问题的解决办法
2016/08/08 Javascript
JavaScript设计模式之单体模式全面解析
2016/09/09 Javascript
轻松理解vue的双向数据绑定问题
2017/10/30 Javascript
Vue EventBus自定义组件事件传递
2018/06/25 Javascript
详解微信小程序canvas圆角矩形的绘制的方法
2018/08/22 Javascript
详解在Javascript中进行面向切面编程
2019/04/28 Javascript
在vue-cli 3中给stylus、sass样式传入共享的全局变量
2019/08/12 Javascript
[52:36]VGJ.S vs Serenity 2018国际邀请赛小组赛BO2 第一场 8.19
2018/08/21 DOTA
[40:04]Secret vs Infamous 2019国际邀请赛淘汰赛 败者组 BO3 第二场 8.23
2019/09/05 DOTA
Python设计模式之单例模式实例
2014/04/26 Python
在Python中使用HTML模版的教程
2015/04/29 Python
详解Python3操作Mongodb简明易懂教程
2017/05/25 Python
Python递归函数 二分查找算法实现解析
2019/08/12 Python
Python 绘制可视化折线图
2020/07/22 Python
详解canvas绘图时遇到的跨域问题
2018/03/22 HTML / CSS
html5 input输入实时检测以及延时优化
2018/07/18 HTML / CSS
英国汽车座椅和婴儿车购物网站:Uber Kids
2017/04/19 全球购物
自荐信如何“自荐”
2013/10/24 职场文书
大众服装店创业计划书范文
2014/01/01 职场文书
证婚人搞笑证婚词
2014/01/10 职场文书
超市创业计划书
2014/04/24 职场文书
高校教师个人工作总结2014
2014/12/17 职场文书
实现AJAX异步调用和局部刷新的基本步骤
2022/03/17 Javascript
我们认为中短波广播场强仪的最佳组合
2022/04/05 无线电