Get Smarty

Donate

Donate Bitcoin Bitcoin
Paypal

Smarty Icon

You may use the Smarty logo according to the trademark notice.

Smarty Template Engine Smarty Template Engine

For sponsorship, advertising, news or other inquiries, contact us at:

Sites Using Smarty

Buy cheap eyeglasses from Cheapglasses123.com and save up to 80%.

Buy prescription glasses from www.australiaglasses.com and save.

Cheap Glasses Now On Sale at GlassesPeople.com. Starts At $7.95.

Where to buy discount wedding dresses and cheap smart dresses free shipping - Weddingdresstrend.com

Brautkleider auf Topwedding.de

Find free files to download on allwhatyouwant.net

Looking For Affordable Wedding Dresses 2015 at Best Prices On TDBridal.com

Shop high quality cheap prom dresses on Dresswe.co.uk

Buy New Arrival Cheap Prom Dresses 2015 at JDBRIDAL Prom Dress Store

Advertisement

Chapter 3. 基本语法

Smarty的标签都是使用定界符括起�。 默认定界符是{ 和 }, 但定界符�以被改�。

比如说在本手册,我们会�定你在使用默认的定界符。 在Smarty看�,任何在定界符之外的内容,都是��的,或者是�改�的内容。 当Smarty读�到这些标签时,将会试图解�它们,并且在对应的�置输出结果。

注释

模�中的注释是星�开头,然�外�包�� 定界符, 就�这样:


{* 这是一个注释 *}

   

Smarty的注释在�会在最终的页�输出里显示, �<!-- HTML comments -->一样。 这是内部进行一些标记而�被人看到的好方法;-)

Example 3.1. 注释例�


{* 我是一个Smarty的注释, 显示输出时我�会存在  *}
<html>
<head>
<title>{$title}</title>
</head>
<body>

{* �一个�行的注释例�  *}
<!-- HTML 注释会��到�览器 -->

{* 
   Smarty的多行
   注释
   �会��到�览器
*}

{*********************************************************
多行注释的说明�
  @ author:         bg@example.com
  @ maintainer:     support@example.com
  @ para:           var that sets block style
  @ css:            the style output
**********************************************************}

{* 头部文件包括LOGO和其他东西  *}
{include file='header.tpl'}


{* 开�说明:  $includeFile是通过foo.php赋值的  *}
<!-- 显示 main content � -->
{include file=$includeFile}

{* 这里的 <select> �是多余的 *}
{*
<select name="company">
  {html_options options=$vals selected=$selected_id}
</select>
*}

<!-- ��被注释了 -->
{* $affiliate|upper *}

{* 注释�能嵌套 *}
{*
<select name="company">
  {* <option value="0">-- none -- </option> *}
  {html_options options=$vals selected=$selected_id}
</select>
*}

</body>
</html>

  

Comments
No comments for this page.
Post a Comment
All comments are moderated. Support questions are ignored, use the forums instead.
Author:
Email: (not shown)
What is 20 plus 5? (Are you human?)

Advertisement