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实现让页面只能被百度gogole蜘蛛访问的方法
Dec 29 PHP
php抓取https的内容的代码
Apr 06 PHP
php数组函数序列之krsort()- 对数组的元素键名进行降序排序,保持索引关系
Nov 02 PHP
PHP数组 为文章加关键字连接 文章内容自动加链接
Dec 29 PHP
PDO预处理语句PDOStatement对象使用总结
Nov 20 PHP
PHP贪婪算法解决0-1背包问题实例分析
Mar 23 PHP
php文件扩展名判断及获取文件扩展名的N种方法
Sep 12 PHP
PHP+Mysql+jQuery中国地图区域数据统计实例讲解
Oct 10 PHP
Symfony2开发之控制器用法实例分析
Feb 05 PHP
PHP实现多关键字加亮功能
Oct 21 PHP
PHP进阶学习之依赖注入与Ioc容器详解
Jun 19 PHP
PHP命名空间定义与用法实例分析
Aug 14 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实现的迪科斯彻(Dijkstra)最短路径算法实例
2017/09/16 PHP
laravel 模型查询按照whereIn排序的示例
2019/10/16 PHP
js Event对象的5种坐标
2011/09/12 Javascript
JavaScript中的this关键字介绍与使用实例
2013/06/21 Javascript
javascript:void(0)是什么意思示例介绍
2013/11/17 Javascript
node.js中的fs.lstatSync方法使用说明
2014/12/16 Javascript
jquery获取多个checkbox的值异步提交给php
2015/07/07 Javascript
JS实现可关闭的对联广告效果代码
2015/09/14 Javascript
jquery使用on绑定a标签无效 只能用live解决
2016/06/02 Javascript
Javascript中数组去重与拍平的方法示例
2017/02/03 Javascript
微信小程序 获取session_key和openid的实例
2017/08/17 Javascript
Angular2 父子组件通信方式的示例
2018/01/29 Javascript
Node.js操作系统OS模块用法分析
2019/01/04 Javascript
详解element-ui中form验证杂记
2019/03/04 Javascript
nodejs读取图片返回给浏览器显示
2019/07/25 NodeJs
浅谈使用nodejs搭建web服务器的过程
2020/07/20 NodeJs
[02:47]DOTA2亚洲邀请赛 HR战队出场宣传片
2015/02/07 DOTA
[00:20]TI9观赛名额抽取Ⅱ
2019/07/24 DOTA
最大K个数问题的Python版解法总结
2016/06/16 Python
python 容器总结整理
2017/04/04 Python
python列表的增删改查实例代码
2018/01/30 Python
教你利用Python玩转histogram直方图的五种方法
2018/07/30 Python
Python通过TensorFlow卷积神经网络实现猫狗识别
2019/03/14 Python
python 表格打印代码实例解析
2019/10/12 Python
python 爬取免费简历模板网站的示例
2020/09/27 Python
Unix/Linux开发面试题
2016/08/16 面试题
文员个人的求职信范文
2013/09/26 职场文书
大一期末自我鉴定
2013/12/13 职场文书
总经理职责
2013/12/22 职场文书
师范生自我鉴定
2014/03/20 职场文书
优秀乡村医生事迹材料
2014/05/28 职场文书
2015元旦节寄语
2014/12/08 职场文书
成本低的5个创业项目:投资小、赚钱快
2019/08/20 职场文书
Nginx+Windows搭建域名访问环境的操作方法
2022/03/17 Servers
Windows 64位 安装 mysql 8.0.28 图文教程
2022/04/19 MySQL