[eluser]InsiteFX[/eluser]
I would create a MY_Controller and add the table template to
it, this way it will always be avaiable to you in your views.
Change your controller to this.
Code:
function index() {
$tmpl = array (
'table_open' => '<table border="0" cellpadding="4" cellspacing="0">',
'heading_row_start' => '<tr>',
'heading_row_end' => '</tr>',
'heading_cell_start' => '<th>',
'heading_cell_end' => '</th>',
'row_start' => '<tr>',
'row_end' => '</tr>',
'cell_start' => '<td>',
'cell_end' => '</td>',
'row_alt_start' => '<tr class="alt">',
'row_alt_end' => '</tr>',
'cell_alt_start' => '<td>',
'cell_alt_end' => '</td>',
'table_close' => '</table>'
);
$this->table->set_template($tmpl);
$data['title'] = "Group Contacts";
$this->load->view('header.php', $data);
$this->load->library('table');
$query = $this->db->get('local_group_contacts');
if ($query->num_rows() > 0) {
$this->table->set_heading('Area', 'Contact', 'Telephone');
foreach ($query->result() as $row) {
$this->table->add_row($row->area, $row->fullname, $row->tel);
}
}
$this->load->view('footer.php', $data);
}
Add this to your view
Code:
<?php echo $this->table->generate(); ?>
InsiteFX