【smarty自定义函数用法示例,smarty自定义示例_PHP教程】教程文章相关的互联网学习教程文章

Smarty模版,tpl显示有关问题

Smarty模版,tpl显示问题刚开始学习Smarty模版,其它的配置什么都能成功,但是在写第一个试验程序的无法正常显示 index.php中的内容:: /*载入配置文件*/ 可以确定config文件配置正确。。。。。 include '../config.php'; /*声明数组*/ $arr = array('computerbook','name'=>'PHP进阶阶段','unit_price'=>array('price'=>'¥65.00','unit'=>'本')); /*将标题和数组传给模版*/ $smarty -> assign('title','使用...

smarty的compile_dir 路径有关问题

smarty的compile_dir 路径问题根目录下有templates templates_c configs cache文件夹 下面代码为何报错?Fatal error: Smarty error: the $compile_dir '/templates_c/' does not exist, or is not a directory. ------解决方案--------------------这个目录应该是没有的吧 /templates_c/ 表示你的系统的根目录,而不是你当前网站的根目录 ------解决方案--------------------应该是php无法访问到根目录,看看php.ini设定,是不是...

请问个smarty模版技术的有关问题

请教个smarty模版技术的问题请教下面的功能怎么在smarty模版中表现出来?谢谢。for($i=1;$i$ttt = gettitle(rand(0,$TC));?>.html" target="_blank">------解决方案-------------------- 看样子,是想循环一点东西出来,你可以这样你先在php文件里把 求出来的$ttt全放里一个数组里$t_arr,$smarty->assign('t_arr',$t_arr);然后,在模板文件里用foreach或者,setion遍历t_arr,具体用法看下手册

smarty编译的名字有关问题

smarty编译的名字问题我现在的问题是,news/list.tpl和job/list.tpl编译成相同的名字呢?%%05^058^058216CF%%list.tpl.php但是我看网上有的生成的带目录的,不知道怎么搞的,如下:%%2f%%2fnews%2f%2flist.tpl.php%%2f%%2fjob%2f%2flist.tpl.php如这样的------解决方案-------------------- 参考这篇文章http://www.atoi.cn/blog/archives/215-SmartyAEAEaoAEUEaCAEaaoe.html

thinkPHP如何和smarty整合

thinkPHP怎么和smarty整合,smarty怎么和ThinkPHP整合在一起------解决方案--------------------问之前请先google哈http://hi.baidu.com/dckhello/item/a255b54a655cf700e93504bf太多太多了 ------解决方案--------------------手册说7.6 模板引擎系统支持原生的PHP模板,而且本身内置了一个基于XML的高效的编译型模板引擎,系统默认使用的模板引擎是内置模板引擎,关于这个模板引擎的标签详细使用可以参考模板指南部分。内置的模...

如何在smarty里面的循环中进行assign

怎么在smarty里面的循环中进行assign这个是smarty里面的代码PHP code$i=0; $db->Query("brand_list","select * from `category` where `pid`=2 order by id");//总共有4个结果 while($array = $db->GetArray("brand_list")){$brand_list[] = $array;$i++;$wf->assign("i",$i);//echo $i.,; } $wf->assign(brand_list,$brand_list);这个是模板里面的代码HTML code{foreach from=$brand_list item=list}{$i}, {/foreach} 现在就是在...

小弟我用ZF框整合smarty,出了点异常,请各位帮忙看上了

我用ZF框整合smarty,出了点错误,请各位帮忙看下了。我用ZF框整合smarty,出了点错误,请各位帮忙看下了,貌似是路径的错误。我先是在分别创建了application/views/templates和application/views/templates_c和application/views/templates_c/cache_c文件夹。然后以插件形式。在index.php中加载Smarty。 /* * Date: 2009.8.16 * Author:DaGui * Email:daguizhang@gmail.com * QQ:308...

smarty中括号语法有关问题

smarty中括号语法问题 错误 {$data["bank_data"]["Arrangement"]["id"]} PHP (5.3.9) ERROR (E_USER_ERROR):File: Smarty.class.phpLine: 1092Type: Smarty error: [in tke-g-admin_scopeofwork.tpl line 10]: syntax error: unrecognized tag: $data["bank_data"]["Arrangement"]["id"] (Smarty_Compiler.class.php, line 446)正确 {$data.bank_data.Arrangement.id} 第一个为什么错误呢 ?------解决方案-------------------...

smarty怎么调用php类的常量成员

smarty 如何调用 php类的常量成员php 内容:require("libs/Smarty.class.php");class my_class { const PWD = "gogo"; var $username = "深空";}$class_obj = new my_class;echo $class_obj->username.'';echo $class_obj::PWD.'';$smarty->assign('class_obj', $class_obj);$smarty->display('eg_4_2.tpl');?>tpl内容: {$class_obj->username} {$class_obj::PWD}

smarty在includefile包孕动态内容的时候报错(http500)

smarty 在include file 包含动态内容的时候报错(http 500)直接打开www.test.com/menu/index可以得到列表内容在smarty做的时候:首页index.php包含_head.php,_head.php包含上面那段话,访问:www.test.com/index 就不行了;当然把_head.php中直接替换为www.test.com/menu/index得到的内容也是正确的!请问,应该如何修改呢?------解决方案--------------------报什么错了 ------解决方案-------------------- smarty只是模板技术,...

smarty有关问题咨询

smarty 问题咨询Warning: Smarty::require_once(Smarty_Compiler.class.php) [function.Smarty-require-once]: failed to open stream: No such file or directory in /www/users/luya.com.uhost/common/smarty/Smarty.class.php on line 1454smarty在服务器上出现该故障 请求解决------解决方案--------------------找不到文件, 设置路径出错了 ------解决方案--------------------如果路径没错 可能是权限的问题 chmod -R 777 目...

smarty加载出现有关问题

smarty加载出现问题init.inc.phpPHP codedefine ( __ROOT__, str_replace ( \\, /, dirname ( __FILE__ ) ) ); include Ext/Smarty.class.php; class Tpl extends Smarty {function __construct() {$this->setTemplateDir ( __ROOT__."/View" );$this->setCompileDir (__ROOT__."./comp_c" );$this->left_delimiter = "<{";$this->right_delimiter = "}>";parent::__construct();} }index.phpPHP codeinclude init.inc.php; class ...

smarty,该如何解决

smartyinclude"libs/Smarty.class.php";  $smarty = new Smarty();   $smarty->template_dir ="tpls/templates";  $smarty->compile_dir ="tpls/templates_c";  $smarty->config_dir = "tpls/config";  $smarty->cache_dir ="tpls/cache"; $tpl->left_delimiter = "  $tpl->right_delimiter = "}>";?>报错:Parse error: syntax error, unexpected T_VARIABLE in E:\AppServ\www\test\smarty\main.php on line 3第...

问个SMARTY有关问题

问个SMARTY问题。请问SMARTY中如何去掉 “内容中”中的空白。我使用了trim 和 strip 都是将两旁的空格去掉了。可以内容中的去不掉。我执行的顺序如下。PHP code用去掉左右空白 去掉html标签 截取字符串------解决方案-------------------- 为什么不在php处理完了之后再传给smarty??

PHP有无必要运用Smarty呢?【图】

PHP有无必要使用Smarty呢??使用Smarty是可以处理很多东西,但是近来本人相当的困惑,有无这个必要呢????它提供了很多页面的模板指令,但是我在开发的过程中实际上都很少用到... 每次都挂上这个东西是不是浪费呢??比如这个生成RSS的代码,使用原生的PHP相当的简单 //这后面不能加换行符; ?> Module Action Menuappstore/contenter/action-menu/exep-menu.xml每个菜单模块下有多个菜单链接,每个连接对应此文件中的一个item项.这个文件必...