Welcome Guest, Not a member yet? Register   Sign In
Help With Generated Breadcrumbs (Code Inside)
#1

[eluser]Jay Logan[/eluser]
I store my page info in a database which pages it somewhat easy to generate breadcrumb naviation....or so I thought. I use this model to build proper array of breadcrumb pages.

Code:
function build_breadcrumbs($where = FALSE, $current_crumbs = FALSE, $counter = 0)
        {
            
            $bc_key = $counter + 1;
        
            $this->db->select();
            $this->db->from('JL_page_contents');
            
            if ($where) {
            
                foreach ($where as $key => $value) {
                
                    $this->db->where($key, $value);
                    
                }
                
            }
            
            $get_page_contents = $this->db->get();
            $page_contents = $get_page_contents->row_array();
            
            $breadcrumbs = $current_crumbs;
            $breadcrumbs[$bc_key]['page_name'] = $page_contents['name'];
            $breadcrumbs[$bc_key]['page_uri_string'] = $page_contents['uri_string'];
            
            if ($page_contents['parent_id'] != $page_contents['id']) {
            
                $this->build_breadcrumbs(array('id' => $page_contents['parent_id']), $breadcrumbs, $bc_key);
                
            } else {
            
                $result = array_reverse($breadcrumbs);
                return $result;
                
                //print_r($result);

            }
        
        }

But the data returns FALSE. Although if I print_r() in the model, it shows the array. So am I doing something wrong that the data isn't being sent to my Library?




Theme © iAndrew 2016 - Forum software by © MyBB