public function catGoodsCount($cat_id) { $category = new Catmodel(); $cats = $category->select(); // 取出所有的栏目来 $sons = $category->getCatTree($cats, $cat_id); // 取出给定栏目的子孙栏目 $sub = array($cat_id); if (!empty($sons)) { // 没有子孙栏目 foreach ($sons as $v) { $sub[] = $v['cat_id']; } } $in = implode(',', $sub); $sql = 'select count(*) from ' . $this->table . ' where cat_id in (' . $in . ')'; return $this->db->getOne($sql); }
<?php /*** file index.php ***/ define('AICN', true); session_start(); if (isset($_SESSION['username']) && $_SESSION['username'] == 'jingling0101') { require '../include/init.php'; $gds_id = $_GET['goods_id'] + 0; //print_r($gds_id); $good = new goodsmodel(); $g = array(); $g = $good->findsingle($gds_id); $xq = $good->findsinglexq($gds_id); //print_r($g); //print_r($xq); $cat = new Catmodel(); $catlist = $cat->select(); $catlist = $cat->getcattree($catlist); //print_r($catlist); include ROOT . 'hment/goodsdit.html'; }
<?php /*** file index.php ***/ define('AICN', true); session_start(); if (isset($_SESSION['username']) && $_SESSION['username'] == 'jingling0101') { require '../include/init.php'; //echo ROOT; $catlist = new Catmodel(); $cattree = $catlist->select(); $cattree = $catlist->getcattree($cattree, 0); //print_r($cattree); include ROOT . 'hment/catelis.html'; }