示例#1
0
 public function navlist()
 {
     $goodstype = M('goodstype');
     $data = $goodstype->field("id,name,pid,path,concat(path,'-',id) as npth")->order("npth")->select();
     $newdata = unLimitedForLayer($data);
     //dump($newdata);
     $this->assign('type', $newdata);
     $this->display('Index:navlist');
 }
示例#2
0
function unLimitedForLayer($cate, $name = 'child', $pid = 0)
{
    $arr = array();
    foreach ($cate as $v) {
        if ($v['pid'] == $pid) {
            $v[$name] = unLimitedForLayer($cate, $name, $v['id']);
            $arr[] = $v;
        }
    }
    return $arr;
}