Get Smarty

Donate

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

Advertisement

Get the juciest casino bonuses at this great website

If you are looking for great entertainment online, then we would like to recommend CasinoAdvisers.com. Find the best casino bonus available and much more that makes your casino experience much more enjoyable!

数学计算

变量值内可以直接进行数学计算。

Example 3.7. 数学计算例子


{$foo+1}

{$foo*$bar}

{* 更复杂的例子 *}

{$foo->bar-$bar[1]*$baz->foo->bar()-3*7}

{if ($foo+$bar.test%$baz*134232+10+$b+10)}

{$foo|truncate:"`$fooTruncCount/$barTruncFactor-1`"}

{assign var="foo" value="`$foo+$bar`"}

  

Note

虽然Smarty可以处理一些非常复杂的表达式和运算, 但最好还是保存模板的语法简洁,把焦点放在显示上。 如果你发现某部分模板代码过于复杂,一个好的方法是将这部分的代码放到插件或者修饰器内使用。

Comments
No comments for this page.

Advertisement