I'm trying to figure out a better way of doing what it is I'm wanting to do. Right now in my controller I have the following code. It checks to see if the user has any messages to view and if they do it sets the table template and sets the table data and then displays the inbox view. If there was not data to display it views a generic view for displaying any message. What I would like to do is no matter what still display some html regardless if there is data or not. I want to display the inbox link, create a message link, etc. Better way of doing this?
if (count($messages) > 0)
{
$tmpl = array('table_open' => '<table class="table table-bordered table-condensed table-striped table-vertical-center checkboxs js-table-sortable">', 'row_start' => '<tr class="selectable">');
$this->table->set_template($tmpl);
$this->table->set_heading(form_checkbox(), 'From', 'Subject', 'Date', 'Actions');
foreach ($messages AS $message)
{
$this->table->add_row(form_checkbox(), $message->sender_id, $message->subject, date('F d, Y', strtotime($message->date_sent)), '<a href="'. site_url() .'wrestling-manager/control-panel/personal-messages/inbox/delete/' . $message->id .'" class="btn-action glyphicons remove_2 btn-danger"><i></i></a>');
}
$this->template->build('inbox_view');
}
else
{
$data = array('message' => 'There are no messages in your inbox folder.');
$this->template->build('general_view', $data);
}