Welcome Guest, Not a member yet? Register   Sign In
Forum Help
#1

[eluser]mStreet[/eluser]
Hello!

I'm quite new to OOP as well as Codeigniter, so please bare with me.
Currently I'm just fooling around to just try and get a hang of it all. So I'm building a forum at the moment.

I got stuck on the categories, so I searched all over the place hoping to find a solution, which I did (almost). Then I got stuck trying to print it all out.

I got everything ready and the var dump looks like this:

Vardump IMAGE

It looks exactly like it should but I just can't manage to echo it out correctly.

Here's the controller:

Code:
function categories($parent = NULL) {
        $items = array();
        
        $this->db->where('parent_id', $parent);
        $query = $this->db->get('categories');
        $results = $query->result();
        
        foreach($results as $result) {
            $child_array = Forum::categories($result->id);
            if(sizeof($child_array) == 0) {
                array_push($items, $result->name);
            } else {
                array_push($items, array($result->name, $child_array));
            }
        }
        
        return $items;
    }


Thanks!


Messages In This Thread
Forum Help - by El Forum - 04-04-2012, 11:42 AM
Forum Help - by El Forum - 04-04-2012, 02:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB