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 26 PHP
PHP加密函数 Javascript/Js 解密函数
Sep 23 PHP
简单分析ucenter 会员同步登录通信原理
Aug 25 PHP
PHP读取txt文本文件并分页显示的方法
Mar 11 PHP
PHP中异常处理的一些方法整理
Jul 03 PHP
深入探究PHP的多进程编程方法
Aug 18 PHP
PHP单链表的实现代码
Jul 05 PHP
PHP二维数组去重实例分析
Nov 18 PHP
PHP精确计算功能示例
Nov 29 PHP
php之可变变量的实例详解
Sep 12 PHP
PHP开发之用微信远程遥控服务器
Jan 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中的session永不过期的解决思路及实现方法分享
2011/04/20 PHP
PHP字符串比较函数strcmp()和strcasecmp()使用总结
2014/11/19 PHP
smarty中改进truncate使其支持中文的方法
2016/05/30 PHP
搜索附近的人PHP实现代码
2018/02/11 PHP
执行iframe中的javascript方法
2008/10/07 Javascript
IE6不能修改NAME问题的解决方法
2010/09/03 Javascript
js获取系统的根路径实现介绍
2013/09/08 Javascript
JavaScript实现简单图片滚动附源码下载
2014/06/17 Javascript
js控制鼠标事件移动及移出效果显示
2014/10/19 Javascript
详解Bootstrap按钮
2016/01/04 Javascript
bootstrap网页框架的使用方法
2016/05/10 Javascript
Backbone中View之间传值的学习心得
2016/08/09 Javascript
jacascript DOM节点——元素节点、属性节点、文本节点
2017/04/18 Javascript
关于jQuery.ajax()的jsonp碰上post详解
2017/07/02 jQuery
js禁止Backspace键使浏览器后退的实现方法
2017/09/01 Javascript
jQuery进阶实践之利用最优雅的方式如何写ajax请求
2017/12/20 jQuery
JS实现的将html转为pdf功能【基于浏览器端插件jsPDF】
2018/02/06 Javascript
用js简单提供增删改查接口
2019/05/12 Javascript
ES6中的迭代器、Generator函数及Generator函数的异步操作方法
2019/05/12 Javascript
Python实现的Excel文件读写类
2015/07/30 Python
python列表每个元素同增同减和列表元素去空格的实例
2019/07/20 Python
Pytorch保存模型用于测试和用于继续训练的区别详解
2020/01/10 Python
python读取dicom图像示例(SimpleITK和dicom包实现)
2020/01/16 Python
tensorflow2.0与tensorflow1.0的性能区别介绍
2020/02/07 Python
Python实现粒子群算法的示例
2021/02/14 Python
python 制作网站小说下载器
2021/02/20 Python
css3背景_动力节点Java学院整理
2017/07/11 HTML / CSS
翻新二手苹果产品的网络领导者:Mac of all Trades
2017/12/19 全球购物
介绍一下write命令
2012/09/24 面试题
门卫班长岗位职责
2013/12/15 职场文书
家长会邀请书
2014/01/25 职场文书
通用自荐信范文
2014/03/14 职场文书
爱的奉献演讲稿
2014/09/10 职场文书
换届选举主持词
2015/07/03 职场文书
调解协议书范本
2016/03/21 职场文书
《中华上下五千年》读后感3篇
2019/11/29 职场文书