分类 现实数量定义
public function category($catid)
{
$catid = str_replace("template/category/","",$catid);
$catid=(int) $catid;
$search='';
if(!empty($catid)){
$sortpath=$this->db->fetch_one("select sort_path from ".WEBMENG_CONMENG."category_templates_web where cat_id='".$catid."' ");
$search.=" and catid in(select cat_id from ".WEBMENG_CONMENG."category_templates_web where sort_path like '".$sortpath."%' ) ";
}
//$sql = "select *,thumb as img,inputtime as addtime from ".WEBMENG_CONMENG."templates_web where status>0 order by inputtime desc ".$search;
$sql = "select *,thumb as img,inputtime as addtime from ".WEBMENG_CONMENG."templates_web where status>0 ".$search;
$all_goods = page_for_db_extend($sql,'',18); //查询带分页的每一页显示18条记录
// $all_goods = page_for_db_extend($sql); //查询带分页的
$data = array(
'info_reslut' => $all_goods['data'],
'showpage' => $all_goods['page'],
'template_count' => $all_news['total'],
//'category_web' => $template_list
'templates_web' => $this->category_templates_web()
);
$this->display('cn/template/category.html',$data);
}
public function category_templates_web()
{
$goods_list = $this->db->fetch("select cat_name as sortname,cat_id as id,parent_id from ".WEBMENG_CONMENG."category_templates_web ");
$templates_web = array();
$parent = array();
if(!empty($goods_list)){
foreach ($goods_list as $v) {
if($v['parent_id']==0){
$templates_web[] = $v;
}
$parent[$v['parent_id']][]=$v;
}
foreach ($templates_web as $k => $v) {
$templates_web[$k]['child'] = isset($parent[$v['id']])?$parent[$v['id']]:array();
if(!empty($templates_web[$k]['child'])){
foreach ($templates_web[$k]['child'] as $key => $value) {
$templates_web[$k]['child'][$key]['child'] = isset($parent[$value['id']])?$parent[$value['id']]:array();
}
}
}
}
return $templates_web;
}
创梦商城 | Messager | 家园 | 晓梦客服 | 游戏 | 音乐 | 路由器 | 粉卡 | 政企服务 | 天猫店 | 隐私政策| 问题反馈
© ConmengMall.Com 炫梦(上海)动漫文化发展有限公司 沪ICP备10004645号-1
违法和不良信息举报电话:135-8572-0501,本网站所列数据,除特殊说明,所有数据均出自我司实验室测试