属性
大部分函数接受属性(或者更通俗的说是“参数”)来制定或修订它们的行为。Smarty函数的属性非常类似HTML属性。静态值不需要被包含在引号中,但是对于字符串我们推荐这么做。也可以用变量,但不能包含在引号中。
有些属性要求布尔值(真或假)。它们可以被指定为不带引号的true,on以及yes,或者false,off以及no。
例子3-4. 函数属性语法
{include file='header.tpl'}
{include file='header.tpl' attrib_name='attrib value'}
{include file=$includeFile}
{include file=#includeFile# title='Smarty is cool'}
{html_select_date display_days=yes}
{mailto address='smarty@example.com'}
<select name='company_id'>
{html_options options=$companies selected=$company_id}
</select> |
|