Generating your Table
After you have prepared your table object, call generate() to return the table HTML.
This should be the last call you make to each badtable object.
generate (array attributes)
- attributes: an array of attributes to apply to the table | optional
Example:
$attr = array(
'style' => 'width:100%;',
'class' => 'styled-table'
);
$this->badtable->generate($attr);
generate (array table_data)
- table_data: an array of row arrays | optional
Example:
$data = array(
array('Name', 'Color', 'Size'),
array('Fred', 'Blue', 'Small'),
array('Mary', 'Red', 'Large'),
array('John', 'Green', 'Medium')
);
$this->badtable->generate($data);
generate (object db_query)
- db_query: an array of row arrays | optional
Example:
$query = $this->db->query("SELECT * FROM my_table");
$this->badtable->generate($query);
generate (mixed table_data [,array attributes])
- table_data: an array or db object containing table data | optional
- attributes: an array of attributes to apply to the table | optional
Example:
$data = array(
array('Name', 'Color', 'Size'),
array('Fred', 'Blue', 'Small'),
array('Mary', 'Red', 'Large'),
array('John', 'Green', 'Medium')
);
$attr = array(
'style' => 'width:100%;',
'class' => 'styled-table'
);
$this->badtable->generate($data, $attr);