Example #1
0
 public function index()
 {
     $plist = $this->db->field('id,fup,type,name,key,list')->select();
     //对菜单按子级顺序重排
     $plist = sarr($plist, 0);
     $this->assign('plist', $plist);
     $this->display();
 }
Example #2
0
 public function sortlist()
 {
     import("@.ORG.Page");
     $db = M('cms_sort');
     $count = $db->count();
     $Page = new Page($count, 50);
     $plist = $db->order('id')->limit($Page->firstRow . ',' . $Page->listRows)->select();
     $show = $Page->show();
     //对栏目按子级顺序重排
     $plist = sarr($plist, 0);
     $this->assign('show', $show);
     $this->assign('plist', $plist);
     $this->display();
 }
Example #3
0
function sarr($arr, $id)
{
    global $ic;
    $thisa = array();
    $aarr = seekarr($arr, 'fup', $id);
    //fup 上级
    if (count($aarr) > 0) {
        for ($i = 0; $i < count($aarr); $i++) {
            $thisa[$ic] = $aarr[$i];
            $ic += 1;
            $o = $aarr[$i]['id'];
            //fid 栏目id
            $toarr = sarr($arr, $o);
            if (count($toarr) > 0) {
                $thisa = array_merge($thisa, $toarr);
            }
        }
        return $thisa;
    }
}