View Single Post
ישן 25-07-10, 14:37   # 13
Gal Shafrir
חבר וותיק
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
הודעות: 1,626

Gal Shafrir לא מחובר  

משהו בסגנון הזה?

PHP קוד:
    public function get_by_parent_recursive($lang ''$parentID 0$arr = array())
    {
        
$this->db->where('lang'$lang);
        
$this->db->where('parentID'$parentID);
        
$query $this->db->get('pages');
        
        
$results $query->result_array();
        
        if (
$query->num_rows() > 0)
        {
            
$results $results[0];
            
            
// Recall the function
            
$arr $this->get_by_parent_recursive('he'$results['ID'], $results);

            
// Merging the parent and it's child arrays
            //
            // while the page's settings related fields are taken from the parent's
            // and the content related fields from the child's
            
            
if (count($arr) > 0)
            {
                if (empty(
$results['content']))
                    
$results['content'] = $arr['content'];
                
                if (empty(
$results['title']))
                    
$results['title'] = $arr['title'];
                    
                if (empty(
$results['name']))
                    
$results['name'] = $arr['name'];
            }
        }
        
        return 
$results;
    } 
__________________
בברכה,
גל שפריר - מעצב ומפתח אתרים.

עופר שפריר - במאי, תסריטאי ומפיק.
  Reply With Quote