I am trying to reuse a table template for the table library in multiple pages. I have tried to save the template in a *php file to later call it as an include but that isn't working. My code looks like this:
//on the controller
$this->load->view('includes/tabularDataTemplate.php');
//this is the contents of the tabularDataTemplate.php file
$tmpl = array (
'table_open' => '<table border="1" 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>',
'row_alt_end' => '</tr>',
'cell_alt_start' => '<td>',
'cell_alt_end' => '</td>',
'table_close' => '</table>'
);
$this->table->set_template($tmpl);
I am sure there has to be a better (working) way to achieve this.