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中ob(Output Buffer 输出缓冲)函数使用方法
Jul 21 PHP
PHP中=赋值操作符对不同数据类型的不同行为
Jan 02 PHP
深入php处理整数函数的详解
Jun 09 PHP
yii框架通过控制台命令创建定时任务示例
Apr 30 PHP
PHP读取RSS(Feed)简单实例
Jun 12 PHP
php截取中文字符串函数实例
Feb 23 PHP
php使用curl出现Expect:100-continue解决方法
Mar 03 PHP
PHP实现QQ空间自动回复说说的方法
Dec 02 PHP
详解PHP中mb_strpos的使用
Feb 04 PHP
PHP实现QQ、微信和支付宝三合一收款码实例代码
Feb 19 PHP
详解PHP PDO简单教程
May 28 PHP
laravel5.6实现数值转换
Oct 23 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
德生PL330的评价与改造
2021/03/02 无线电
通过dbi使用perl连接mysql数据库的方法
2014/04/16 PHP
php实现建立多层级目录的方法
2014/07/19 PHP
实例介绍PHP的Reflection反射机制
2014/08/05 PHP
Laravel模型事件的实现原理详解
2018/03/14 PHP
JavaScript Cookie显示用户上次访问的时间和次数
2009/12/08 Javascript
分享jQuery封装好的一些常用操作
2016/07/28 Javascript
AngularJS动态绑定HTML的方法分析
2016/11/07 Javascript
jQuery快速实现商品数量加减的方法
2017/02/06 Javascript
原生JavaScript实现AJAX、JSONP
2017/02/07 Javascript
node.js自动上传ftp的脚本分享
2018/06/16 Javascript
微信小程序实现日期格式化和倒计时
2020/11/01 Javascript
使用localStorage替代cookie做本地存储
2019/09/25 Javascript
JS实现transform实现扇子效果
2020/01/17 Javascript
JS通过识别id、value值对checkbox设置选中状态
2020/02/19 Javascript
vue相关配置文件详解及多环境配置详细步骤
2020/05/19 Javascript
Js数组扁平化实现方法代码总汇
2020/11/11 Javascript
Python自动化开发学习之三级菜单制作
2017/07/14 Python
django站点管理详解
2017/12/12 Python
Python判断中文字符串是否相等的实例
2018/07/06 Python
python之拟合的实现
2019/07/19 Python
Django缓存系统实现过程解析
2019/08/02 Python
pyinstaller打包opencv和numpy程序运行错误解决
2019/08/16 Python
TensorFlow实现打印每一层的输出
2020/01/21 Python
Python实现屏幕录制功能的代码
2020/03/02 Python
Python连接Mysql进行增删改查的示例代码
2020/08/03 Python
H5 canvas中width、height和style的宽高区别详解
2018/11/02 HTML / CSS
台湾线上百货零售购物平台:friDay购物
2017/08/18 全球购物
品质主管的岗位职责
2013/12/04 职场文书
文明家庭先进事迹材
2014/01/27 职场文书
安全生产网格化管理实施方案
2014/03/01 职场文书
给校长的建议书100字
2014/05/16 职场文书
学校安全防火方案
2014/06/07 职场文书
出纳工作检讨书范文
2014/12/27 职场文书
关于调整工作时间的通知
2015/04/24 职场文书
新党员入党决心书
2015/09/22 职场文书