Table Objects
Text…
Parameters
- attributes = array()
Functions:
add_header_element**( $object )
This Objects will be encapsulated with <thead>
and <tr>
tag
add_row_element**( $object )
This Objects will be encapsulated with <tbody>
tag.
new TableObject($attributes);
Usage:
$table = new TableObject(array("id" => "my_table"));
$table->add_header_element( new HtmlObject( "th", array(), $array["title"]));
foreach($entries as $entry) {
$tr = new HtmlObject( 'td', $column_attributes, $td_content )
$tr->add_subelement( new HtmlObject( 'td', $column_attributes, $td_content ));
$table->add_row_element($tr);
}
echo $table->get_template();
Output:
<table id='my_table'>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>