Smarty中调用FCKeditor的方法
2015-01-24信息快讯网
这篇文章主要介绍了Smarty中调用FCKeditor的方法,对比常见的错误方法讲述了Smarty中调用FCKeditor的实现过程,是非常实用的技巧,需要的朋友可以参考下
本文实例讲述了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程序设计有所帮助。
将FCKeditor导入PHP+SMARTY的实现方法
php实现redis数据库指定库号迁移的方法
php正则匹配html中带class的div并选取其中内容的方法
php计划任务之ignore_user_abort函数实现方法
CI框架中site_url()和base_url()的区别
Zend Guard使用指南及问题处理
PHP中使用CURL获取页面title例子
php实现监控varnish缓存服务器的状态
discuz目录文件资料汇总
php连接oracle数据库及查询数据的方法
VPS中使用LNMP安装WordPress教程
php+jQuery.uploadify实现文件上传教程
PHP连接MSSQL时nvarchar字段长度被截断为255的解决方法
腾讯微博提示missing parameter errorcode 102 错误的解决方法
php提示Failed to write session data错误的解决方法
PHP实现的sqlite数据库连接类
Smarty中常用变量操作符汇总
smarty简单分页的实现方法
smarty半小时快速上手入门教程
PHP改进计算字符串相似度的函数similar_text()、levenshtein()
Windows下的PHP安装pear教程
Windows下安装PHP单元测试环境PHPUnit图文教程
自己写的兼容低于PHP 5.5版本的array_column()函数
ThinkPHP整合百度Ueditor图文教程
php生成百度sitemap站点地图类函数实例
Linux下安装oracle客户端并配置php5.3
PHP的switch判断语句的“高级”用法详解
PHP的mysqli_query参数MYSQLI_STORE_RESULT和MYSQLI_USE_RESULT的区别
PHP错误Warning: Cannot modify header information - headers already sent by解决方法
PHP实现支持GET,POST,Multipart/form-data的HTTP请求类
安装ImageMagick出现error while loading shared libraries的解决方法
PHP提示Cannot modify header information - headers already sent by解决方法
CodeIgniter错误mysql_connect(): No such file or directory解决方法