HBcms是一个用Pear框架+Smarty模板引擎构架的cms项目,欢迎大家参与制作Smarty模板

Chapter 3. Basic Syntax

第三章.基本语法

Table of Contents[内容列表]
Comments[注释]
Functions[函数]
Attributes[属性]
Embedding Vars in Double Quotes[双引号里值的嵌入]
Math[数学运算]

All Smarty template tags are enclosed within delimiters. By default, these delimiters are { and }, but they can be changed.

所有的smarty模板标签都被加上了定界符.
默认情况下是 { 和},但它们是可被改变的.

For these examples, we will assume that you are using the default delimiters. In Smarty, all content outside of delimiters is displayed as static content, or unchanged. When Smarty encounters template tags, it attempts to interpret them, and displays the appropriate output in their place.

例如,我们假定你在使用默认定界符.
在smarty里,所有定界符以外的内容都是静态输出的,或者称之为不可改变.
当smarty遇到了模板标签,将尝试解释他们,然后再以恰当的方式输出 .

Comments[注释]

Template comments are surrounded by asterisks, and that is surrounded by the delimiter tags like so: {* this is a comment *} Smarty comments are not displayed in the final output of the template. They are used for making internal notes in the templates.

模板注释被*号包围,例如 {* 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 *}
<SELECT name=company>
{html_options values=$vals selected=$selected output=$output}
</SELECT>
这是一份简单的Smarty手册和Smarty教材,熟练掌握Smarty模板,让您做项目事半功倍