设施服务
更多参数
是否上门
上门服务
|
服务描述
{
$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;
}
联系我时,请说是在 看到的,谢谢!