Professional CodeIgniter, Thomas Myer

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
c04.indd 78
c04.indd 78
6/10/08 5:34:17 PM
6/10/08 5:34:17 PM


Другие страницы

 
Cкачать книги бесплатно без регистрации в электронном виде (pdf, chm, txt).Вы можете читать книги онлайн на нашем сайте литературного портала книг.Большая подборка учебников, пособий, интересных книг.Электронные книги на английском языке скачать бесплатно без смс.

OK

Loading...
...
Закрыть