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解析html的实现代码
Aug 08 PHP
php中$_REQUEST、$_POST、$_GET的区别和联系小结
Nov 23 PHP
初步介绍PHP扩展开发经验分享
Sep 06 PHP
php计算程序运行时间的简单例子分享
May 10 PHP
百度实时推送api接口应用示例
Oct 21 PHP
Linux环境下php实现给网站截图的方法
May 03 PHP
详细解读php的命名空间(一)
Feb 21 PHP
PHP钩子实现方法解析
May 21 PHP
基于laravel where的高级使用方法
Oct 10 PHP
phpstudy隐藏index.php的方法
Sep 21 PHP
Laravel中Kafka的使用详解
Mar 24 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函数解决SQL injection
2006/10/09 PHP
十天学会php之第五天
2006/10/09 PHP
一段php加密解密的代码
2007/07/16 PHP
PHP、Nginx、Apache中禁止网页被iframe引用的方法
2020/10/01 PHP
PHP PDOStatement对象bindpram()、bindvalue()和bindcolumn之间的区别
2014/11/20 PHP
PHP中的session安全吗?
2016/01/22 PHP
PHP常用的三种设计模式
2017/02/17 PHP
PHP中快速生成随机密码的几种方式
2017/04/17 PHP
关于ThinkPhp 框架表单验证及ajax验证问题
2017/07/19 PHP
jQuery+css实现图片滚动效果(附源码)
2013/03/18 Javascript
用javascript为页面添加天气显示实现思路及代码
2013/12/02 Javascript
json的使用小结
2016/06/08 Javascript
Angularjs---项目搭建图文教程
2016/07/08 Javascript
微信小程序 animation API详解及实例代码
2016/10/08 Javascript
微信小程序 页面传参实例详解
2016/11/16 Javascript
js 动态生成json对象、时时更新json对象的方法
2016/12/02 Javascript
微信开发 JS-SDK 6.0.2 经常遇到问题总结
2016/12/08 Javascript
node.js 和HTML5开发本地桌面应用程序
2016/12/13 Javascript
AngularJS 前台分页实现的示例代码
2018/06/07 Javascript
vue2.x集成百度UEditor富文本编辑器的方法
2018/09/21 Javascript
js中自定义react数据验证组件实例详解
2018/10/19 Javascript
原生JavaScript实现的无缝滚动功能详解
2020/01/17 Javascript
vue切换菜单取消未完成接口请求的案例
2020/11/13 Javascript
利用Python实现Windows定时关机功能
2017/03/21 Python
python批量替换页眉页脚实例代码
2018/01/22 Python
人脸识别经典算法一 特征脸方法(Eigenface)
2018/03/13 Python
TensorFlow实现卷积神经网络
2018/05/24 Python
树莓派4B+opencv4+python 打开摄像头的实现方法
2019/10/18 Python
Python中base64与xml取值结合问题
2019/12/22 Python
Python3.6安装卸载、执行命令、执行py文件的方法详解
2020/02/20 Python
Pycharm远程连接服务器并实现代码同步上传更新功能
2020/02/25 Python
美国室内盆栽植物购买网站:Plants.com
2020/04/24 全球购物
校优秀毕业生主要事迹
2014/05/26 职场文书
党员对照检查剖析材料
2014/10/13 职场文书
PHP连接MSSQL数据库案例,PHPWAMP多个PHP版本连接SQL Server数据库
2021/04/16 PHP
html5中sharedWorker实现多页面通信的示例代码
2021/05/07 Javascript