- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
function printTree($array){
    global $db;
    for($i=0;$i<(count($array));$i++){
        #print $array[$i]['id'].'='.$array[$i]['title'];
        if($array[$i]['pid']==0){
            print '<li>'.$array[$i]['title']."</li>";
            $child=array();
            for($j=0;$j<count($db);$j++){
                if($db[$j]['pid']!=0 && $db[$j]['pid']==$array[$i]['id']){
                    $child[]=array('id'=>$db[$j]['id'],'pid'=>0,'title'=>$db[$j]['title']);
                }
            }
            print '<ul>';
            print printTree($child);
            print '</ul>';
        }
    }
}
 Follow us!
 Follow us!
Комментарии (3) RSS
Добавить комментарий