摘要: 在插件目录plugins里新建文件 block.插件名.php文件(如 block.插件名.php) 例:block.test2.php 在tpl中新建content.html index.php 运行结果: 阅读全文
posted @ 2016-08-04 17:08 blogging 阅读(214) 评论(0) 推荐(0) 编辑
摘要: 在插件目录plugins里新建文件 modifier.插件名.php文件(如 modifier.插件名.php)例:function smarty_modifier_test($utime, $format){return date($format,$utime);}tpl中新建datetime.h 阅读全文
posted @ 2016-08-04 16:41 blogging 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 创建Smarty插件:在插件目录(plugins)里新建文件 类型.插件名.php文件,然后插件方法名字书写规范: smarty_类型_插件名([...]){}在模板(tpl文件)中调用插件时格式{插件名 参数1=* 参数2=*}例:Function.test.php //文件名<?phpfunct 阅读全文
posted @ 2016-08-04 16:24 blogging 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 1.把字符串里的d字母替换成h格式:{'d'|str_replace:'h':$str}; d要查找的字符 h要替换的字符 $str字符串 2.function test($param){$p1=$param['p1'];$p2=$param['p2'];return '参数1:'.$p1.'参数2 阅读全文
posted @ 2016-08-04 11:53 blogging 阅读(194) 评论(0) 推荐(0) 编辑
摘要: <?phprequire_once('../smarty/Smarty.class.php');//配置信息$smarty=new Smarty();$smarty->left_delimiter="{";$smarty->right_delimiter="}";$smarty->template_ 阅读全文
posted @ 2016-08-04 11:25 blogging 阅读(346) 评论(0) 推荐(0) 编辑
摘要: (1)include用法和php里的include差不多(2)smarty的include还具备自定义属性的功能例如 {include file="header.tpl" title="网站标题" table_bgcolor="c0c0c0"}{include file="header.tpl" s 阅读全文
posted @ 2016-08-04 11:16 blogging 阅读(330) 评论(0) 推荐(0) 编辑
摘要: (1)section、sectionelse功能多,参数多。或许不是太实用。是smarty用来做循环操作的函数之一。(2)了解基本属性name和loop <section name=article loop=$articlelist>{$articlelist[article].title}{$ar 阅读全文
posted @ 2016-08-04 11:00 blogging 阅读(170) 评论(0) 推荐(0) 编辑
摘要: (1)基本句式{if $name eq "Fred"}Welcome Sir.{elseif $name eq "Wilma"}Welcome Ma'am.{else}Welcome,whatever you are.{/if}(2)条件修饰符有很多,请记得简单的几个eq(==) neq(!=)gt 阅读全文
posted @ 2016-08-04 10:48 blogging 阅读(337) 评论(0) 推荐(0) 编辑
摘要: (1)首字母大写capitalize示例:{$articleTitle|capitalize}(2)字符串连接 cat示例:{$articleTitle|cat:" yesterday."} {$mystr|cat:" foever":" foever"}//连接多个字符串 (3)日期格式化 dat 阅读全文
posted @ 2016-08-04 10:34 blogging 阅读(99) 评论(0) 推荐(0) 编辑