[eluser]davidbehler[/eluser]
Why not do it all in the model?
Code:
//in your controller
function show_product_list()
{
$data = array();
$data['product_list'] = $this->Model_name->get_product_list()
$this->load->view('my_view_name', $data);
}
//in your model
function get_product_list()
{
$query = $this->db->get('product');
$return = array();
foreach($query->result_array() as $key => $product)
{
$return[$key] = $product;
$return[$key]['num_image'] = $this->get_num_image($product['id']);
$return[$key]['num_video'] = $this->get_num_video($product['id']);
// and so on
}
return $return;
}
//in your view
print_r($product_list); // or whatever you want to do