Professional CodeIgniter

(singke) #1

Chapter 4: Creating the Main Web Site


Chapter 4: Creating the Main Web Site


78


It appears that you ’ re using the getAllCategories() model function to populate the
$data[ ‘ navlist ’ ] in the controller. This, as noted in Chapter 3 , gets processed as $navlist in the
navigation view. The problem probably lies either in the model function or the way you ’ re handling the
data in the view.

Examining the model function, you should see :

function getAllCategories(){
$data = array();
$Q = $this- > db- > get(‘categories’);
if ($Q- > num_rows() > 0){
foreach ($Q- > result_array() as $row){
$data[] = $row;
}
}
$Q- > free_result();
return $data;
}

Figure 4 - 1
Free download pdf