【最新发布在前面】Webmeng文章分类排序问题

 public function _category($catid)
{

$catid = str_replace("category_","",$catid);
$catid=(int) $catid;

$search='';
if(!empty($catid)){
$sortpath=$this->db->fetch_one("select sort_path from ".WEBMENG_CONMENG."category_record where cat_id='".$catid."'  ");
$search.=" and catid in(select cat_id from ".WEBMENG_CONMENG."category_record where sort_path like '".$sortpath."%') ";
}

$sql = "select *,thumb as img,inputtime as addtime from ".WEBMENG_CONMENG."record where catid='".$catid."' order by inputtime desc ";


$all_record = page_for_db_extend($sql);  //查询带分页的
$data = array(
'info_reslut' => $all_record['data'],
'showpage'    => $all_record['page'],
'category'   => $this->_category_record()
);

$settings = array();
$sets = $this->db->fetch("select * from ".WEBMENG_CONMENG."settings  ");
if(!empty($sets)){
foreach ($sets as $v) {
$webmeng[$v['variable']] = $v;
}
}
$data['webmeng'] = $webmeng;    /*获取内页调用系统信息如LOGO 网站名称*/




$this->display('record/category.html',$data);
}



public function _category_record()
{




$record_list  = $this->db->fetch("select cat_name as sortname,cat_id as id,parent_id from ".WEBMENG_CONMENG."category_record  ");
$category = array();
$parent = array();
if(!empty($record_list)){
foreach ($record_list as  $v) {
if($v['parent_id']==0){
$category[] = $v;
}
$parent[$v['parent_id']][]=$v;
}
foreach ($category as $k => $v) {
$category[$k]['child'] = isset($parent[$v['id']])?$parent[$v['id']]:array();
if(!empty($category[$k]['child'])){
foreach ($category[$k]['child'] as $key => $value) {
$category[$k]['child'][$key]['child'] = isset($parent[$value['id']])?$parent[$value['id']]:array();
}
}
}
}
return $category;
}

餐厅介绍

自助餐厅

4.7分
537m | 中航城区冷死你境内呢名
停车 WiFi
  • 热情1
  • 环境好11
  • 服务好12
  • 好极了31
  • 服务热情14

暂时没有看法.. 发表看法请遵守当地法律和制度 (网友评论仅供其表达个人看法,并不表明本站立场。)