-
- //$count is the classification level
- sort_list($str,$fatherid,$count)
- {
- $rs = $this->sql->re_datas("select * from sort where father_id = fatherid");
- $num = $this->sql->sql_numrows();
- $i=0;
- $n = 1;
- while(isset($rs[$i]))
- {
- $name = "";
- for($n = 1 ; $n < $count ; $n++)
- {
- $name.="│ ";
- }
- if($i+1==$ num)
- {
- $name.="└─".$rs[$i][name];
- }
- else
- {
- $name.="├─".$rs[$i][name];
- }
- if($rs[$i][isdir])
- {
- $str.="".$name."";
- }
- else
- {
- $str.=$name";
- }
- $temp = $count+1;
- $str = $this->sort_list($str,$rs[$i][id],$ temp);
- $i++;
- }
- return $str;
- }
- ?>
-
Copy code
where $this->sql object is a sql operation class object, and the re_datas() function returns the found Array, sql_numrows() function returns the queried number
Calling method: $sort_list = sort_list($sort_list,0,1);
|