功能:把简单数组转化table表格
基本语法:
{html_table loop=$data cols=4 table_attr=’border=”0″‘}
参数说明:
loop:要遍历的数组
cols:每行显示多少列
table_attr:表格的属性,多个属性之间通过空格隔开
demo6.html示例代码:
<!DOCTYPE html> <html> <head> <meta charset=’utf-8′> <title></title> </head> <body> {*html_table*} {html_table loop=$lamp cols=2 table_attr=’border=1 width=500′} </body> </html>
demo6.php代码示例
<?php require “smarty/Smarty.class.php”; $smarty = new Smarty(); $lamp = array(‘php’,’apache’,’lunux’,’mysql’); $smarty -> assign(‘lamp’,$lamp); $smarty -> display(‘demo6.html’);