PHP头条
热点:

php模板引擎smarty的基本语法


注释
模板注释被*号包围,格式为: {* this is a comment *}
例子:   {* Smarty注释www.php118.com *} {* include the header file here *} {include file="header.tpl"} {* display dropdown lists *}
 
函数
在smarty模板里无论是内建函数还是自定义函数都有相同的语法.
内建函数将在smarty内部工作,例如 {if}, {section} 和{strip}.他们不能被修改.
自定义函数通过插件机制起作用,它们是附加函数. 只要你喜欢,可以随意修改.你也可以自行添加.
例如 {html_options} and {html_select_date}
函数语法:{funcname attr1="val" attr2="val"}
大多数函数都带有自己的参数以便于规定和修改他们的行为.
smarty模板引擎里的函数的参数静态数值不需要加引号,但是字符串需要加。
赋值时引用到变量也不需要加引号。
代码片段:
{html_select_date display_days=yes} 由上可知:参数为布尔值也不需要加双引号。

www.phpzy.comtrue/phpkj/10546.htmlTechArticlephp模板引擎smarty的基本语法 注释 模板注释被*号包围,格式为: {* this is a comment *} 例子:{* Smarty注释 www.php118.com *}{* include the header file here *}{include file="header.tpl"}{* display dropdown lists *} {...

相关文章

相关频道:

PHP之友评论

今天推荐