今天需要用到在smarty模版中将两个变量相加

  1. {* $height=4, $width=5 *}
  2. {math equation="x + y" x=$height y=$width}
  3. OUTPUT:
  4. 9

  5. {* $row_height = 10, $row_width = 20, #col_div# = 2, assigned in template *}
  6. {math equation="height * width / division"
  7.       height=$row_height
  8.       width=$row_width
  9.       division=#col_div#}
  10. OUTPUT:
  11. 100

  12. {* you can use parenthesis *}
  13. {math equation="(( x + y ) / z )" x=2 y=10 z=2}
  14. OUTPUT:
  15. 6

  16. {* you can supply a format parameter in sprintf format *}
  17. {math equation="x + y" x=4.4444 y=5.0000 format="%.2f"}
  18. OUTPUT:
  19. 9.44

posted on 2008-12-11 00:11 丁克设计 阅读(1567) 评论(0)  编辑  收藏 所属分类: PHP技术文档


只有注册用户登录后才能发表评论。


网站导航:
 
<2024年4月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

导航

留言簿(6)

随笔档案

文章分类

文章档案

搜索

最新评论

阅读排行榜