` tag (arrays are cycled) |
| td\_attr | No | Attributes for `` tag (arrays are cycled) |
| trailpad | No | Value to pad the trailing cells on last row with (if any) (defaults to ' ') |
| hdir | No | Direction of each row to be rendered. possible values: *right* (left-to-right), and *left* (right-to-left) (defaults to 'right') |
| vdir | No | Direction of each column to be rendered. possible values: *down* (top-to-bottom), *up* (bottom-to-top) (defaults to 'down') |
- 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.
## Examples
```php
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 1 **
```smarty
{html_table loop=$data}
```
```html
```
** Example 2 **
```smarty
{html_table loop=$data cols=4 table_attr='border="0"'}
```
```html
```
** Example 3 **
```smarty
{html_table loop=$data cols="first,second,third,fourth" tr_attr=$tr}
```
```html
first | second | third | fourth |
1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 |
9 | | | |
```
| |