无线分类

    var $tree=array();
    
    
private function treetoary($list,$level=0) {
      
foreach($list as $key=>$val)
      {
        
$tmp_str=str_repeat(" ",$level*2);
        
if($level>0) {
            
$tmp_str.="";
        }
        
$val['sep']=$tmp_str." ".$val['title'];
        
if(!array_key_exists('_child',$val)) {
           
array_push($this->tree,$val);
        }
else{
            
$tmp_ary = $val['_child'];
            
unset($val['_child']);
            
array_push($this->tree,$val);
            
$this->treetoary($tmp_ary,$level+1);
        }
      }
      
return;
    }
    

        
$list = $Dao->findAll("",$field,"ExamCateID desc",$p->firstRow.",".$p->listRows); 
        
$list = $Dao->toTree($list,'ExamCateID','ExamCateFID','_child');
  <iterate name="list" id="list" key="k">
    
<tr>
      
<td align="center"><input type="checkbox"  name="id[]" value="{$list.id}"></td>
      
<td align="left">{$list.id}</td>
      
<td>{$list.sep}{$list.ExamCateName}</td>
      
<td align="center">{$list.ordernum}</td>
      
<td><href="/Web/Tpl/default/Exam/__URL__/add/parentid/{$list.id}">添加子栏目</a>
        
</case>
      
<td><href="/Web/Tpl/default/Exam/__URL__/edit?id={$list.id}">修改</a></td>
      
<td><href="/Web/Tpl/default/Exam/__URL__/delete?id={$list.id}" onClick="return confirm('确定要删除此栏目');">删除</a></td>
    
</tr>
  
</iterate>

posted on 2009-03-02 18:59  52Qin  阅读(311)  评论(0编辑  收藏  举报