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

属性

大多数函数 都会使用属性�定义或者修改它们的行为。 Smarty函数中的属性比较�HTML语法中的属性。 ��值�需�引�引起�,但必须是纯字符串。 带或�带修饰器的��都�以使用,而且也�需�引�, 甚至�以使用PHP函数的结果,�件结果和��的表达�。

一些属性�求布尔值(TRUE 或 FALSE)。 它们�以直接写�true 和 false。 如果属性没有被赋值,那么它会将true作为默认值。

Example 3.4. 函数属性语法


{include file="header.tpl"}

{include file="header.tpl" nocache}  // 等�于 nocache=true

{include file="header.tpl" attrib_name="attrib value"}

{include file=$includeFile}

{include file=#includeFile# title="My Title"}

{assign var=foo value={counter}}  // �件结果

{assign var=foo value=substr($bar,2,5)}  // PHP函数结果

{assign var=foo value=$bar|strlen}  // 使用修饰器

{assign var=foo value=$buh+$bar|strlen}  // ��的表达�

{html_select_date display_days=true}

{mailto address="smarty@example.com"}

<select name="company_id">
  {html_options options=$companies selected=$company_id}
</select>

  

Note

虽然Smarty�以处�很��的表达�和语法,但是最好的方�还是 ��模�语法的简�,模�层专注于显示。 如果�现你的模�语法过于��,那么建议是将这些逻辑代�写到PHP里, 然�在模�中通过�件或者修饰器�调用。

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 15 plus 18? (Are you human?)

Advertisement