[eluser]brandingdavid[/eluser]
Trying to show a category tree (with subcats and sub-subcats)
Using this code:
Code:
<?php
$categories = get_categories();
foreach($categories as $category) {
// Print the top level category
echo $category->title .'<br />';
// get the sub categories
$subcategories = get_categories($category->id);
foreach($subcategories as $subcategory) {
echo '- '. $subcategory->title. '<br />';
}
}
function get_categories($parent = 0) {
$this->db->where('parent', $parent);
$query = $this->db->get('bin_location');
return $query->result();
}
?>
Getting: Fatal error: Call to a member function on a non-object in /home/domains/public_html/system/application/views/frontpage_view.php on line 25
Anyone have any ideas why I am having this problem?