html_table function

html_table function:

#Custom function html_table fills the data in the array into the HTML table. The cols attribute determines how many columns the table has.

table_attr, tr_attr and td_attr attributes determine some additional attributes of the tr and td tags in the table.

If tr_attr and td_attr attribute values ​​are arrays, and the values ​​will be used in turn.

If the trailpad attribute is specified, some data will be appended to the last row at the end of the table.

eg:

index.php:
require('Smarty.class.php');
$smarty = new Smarty ;
$smarty->assign('data',array(1,2,3,4,5,6,7,8,9));
$smarty->assign('tr' ,array('bgcolor="skyblue"','bgcolor="#0f0"'));
$smarty->display('index.tpl');

index. tpl:
{html_table loop=$data}
{html_table loop=$data cols=4 table_attr='border="0"'}
{html_table loop=$data cols=4 tr_attr =$tr}

Output:

:微信图片_20180313123801.png

Continuing Learning
||
<?php echo "html_table函数";
submitReset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!