第三章.基本语法
Table of Contents[内容列表]
Comments[注释]
Functions[函数]
Attributes[属性]
Embedding Vars in Double Quotes[双引号里值的嵌入]
Math[数学运算]
所有的smarty模板标签都被加上了定界符。默认情况下是{ 和},但它们是可被改变的。
例如,我们假定你在使用默认定界符.
在smarty里,所有定界符以外的内容都是静态输出的,或者称之为不可改变.
当smarty遇到了模板标签,将尝试解释他们,然后再以恰当的方式输出 . Comments[注释]
模板注释被*号包围,例如{* this is a comment *}
smarty注释不会在模板文件的最后输出中出现.
它只是模板内在的注释.
Example 3-1. Comments
例3-1.注释
{* Smarty *}
{* include the header file here *}
{include file="header.tpl"}
{include file=$includeFile}
{include file=#includeFile#}
{* display dropdown lists *}
{html_options values=$vals selected=$selected output=$output}
Functions
函数
每一个smarty标签输出一个变量或者调用某种函数.
在定界符内函数(用'{'包住)和其属性(用界符包住)将被处理和输出.例如: {funcname attr1="val" attr2="val"}.
Example 3-2. function syntax