[eluser]bunoire14[/eluser]
Thanks Guys,
Heres how i did it, I think i followed the logic correctly.
I took the suggested route from @johnpeace and created a helper with the function in it:
Code:
//Change any Bool Result into Tick or Cross
function boolean_icon($in)
{
$in = (int)$in; // cast as int just to be sure
$out = array(0 => '<img src="'.base_url().'assets/img/site/cross.png" />', 1 => '<img src="'.base_url().'assets/img/site/tick.png" />');
return $out[$in];
}
As you can see I editied it slightly to return a full image tag.
I then called this helper in my controller like this:
Code:
class Staff extends Controller{
//Site Staff Roster Page Method
function roster()
{
$this->load->model('staff_model');
$this->load->helper('ui');
$data['staff_records'] = $this->staff_model->getStaff();
$this->load->view('site_head');
$this->load->view('staff_roster', $data);
$this->load->view('site_foot');
}
}
Then I used the method in the view like this:
Code:
<?php foreach($staff_records as $row) :?>
<tr>
<td><?php echo $row->pid; ?></td>
<td><?php echo $row->rank.' '.$row->fname.' '.$row->lname.' '; ?></td>
<td><?php echo $row->cfs_role; ?></td>
<td><?php echo $row->callsign; ?></td>
<td><?php echo boolean_icon($row->efts); ?></td>
<td><?php echo boolean_icon($row->one_fts); ?></td>
<td><?php echo boolean_icon($row->two_fts); ?></td>
<td><?php echo boolean_icon($row->three_fts); ?></td>
<td><?php echo boolean_icon($row->four_fts); ?></td>
</tr>
<?php endforeach; ?>
This has the desired resuklt on the page itself, whether I have followed the MVC pattern doing it this way is another matter! LOL :red:
Thanks for the help Chaps,