Welcome Guest, Not a member yet? Register   Sign In
Logical Problem With category and sub-category
#9

[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();
        }
    ?&gt;

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?


Messages In This Thread
Logical Problem With category and sub-category - by El Forum - 04-24-2009, 06:00 AM
Logical Problem With category and sub-category - by El Forum - 04-24-2009, 10:36 AM
Logical Problem With category and sub-category - by El Forum - 04-24-2009, 11:07 AM
Logical Problem With category and sub-category - by El Forum - 04-24-2009, 12:14 PM
Logical Problem With category and sub-category - by El Forum - 04-24-2009, 12:39 PM
Logical Problem With category and sub-category - by El Forum - 04-24-2009, 04:44 PM
Logical Problem With category and sub-category - by El Forum - 04-25-2009, 02:32 AM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 01:34 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 01:49 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 01:56 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 02:02 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 02:08 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 02:16 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 02:18 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 02:21 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 02:24 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 02:26 PM
Logical Problem With category and sub-category - by El Forum - 09-10-2009, 06:06 PM
Logical Problem With category and sub-category - by El Forum - 09-11-2009, 07:31 AM
Logical Problem With category and sub-category - by El Forum - 09-11-2009, 07:48 AM
Logical Problem With category and sub-category - by El Forum - 09-11-2009, 07:51 AM
Logical Problem With category and sub-category - by El Forum - 09-11-2009, 07:56 AM
Logical Problem With category and sub-category - by El Forum - 09-11-2009, 08:12 AM
Logical Problem With category and sub-category - by El Forum - 09-11-2009, 08:18 AM
Logical Problem With category and sub-category - by El Forum - 09-11-2009, 08:36 AM
Logical Problem With category and sub-category - by El Forum - 09-11-2009, 09:07 AM
Logical Problem With category and sub-category - by El Forum - 09-11-2009, 09:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB