` tag (arrays are cycled)
td\_attr string No *empty* Attributes for `` tag (arrays are cycled)
trailpad string No * * Value to pad the trailing cells on last row with (if any)
hdir string No *right* Direction of each row to be rendered. possible values: *right* (left-to-right), and *left* (right-to-left)
vdir string No *down* Direction of each column to be rendered. possible values: *down* (top-to-bottom), *up* (bottom-to-top)
- The `cols` attribute determines how many columns will be in the
table.
- The `table_attr`, `tr_attr` and `td_attr` values determine the
attributes given to the ``, `` and `` tags.
- If `tr_attr` or `td_attr` are arrays, they will be cycled through.
- `trailpad` is the value put into the trailing cells on the last
table row if there are any present.
assign( 'data', array(1,2,3,4,5,6,7,8,9) );
$smarty->assign( 'tr', array('bgcolor="#eeeeee"','bgcolor="#dddddd"') );
$smarty->display('index.tpl');
?>
The variables assigned from php could be displayed as these three
examples demonstrate. Each example shows the template followed by
output.
{**** Example One ****}
{html_table loop=$data}
{**** Example Two ****}
{html_table loop=$data cols=4 table_attr='border="0"'}
{**** Example Three ****}
{html_table loop=$data cols="first,second,third,fourth" tr_attr=$tr}
first | second | third | fourth |
1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 |
9 | | | |
| |