php 多选筛选url,phpcms V9二次开发之联动菜单筛选 包括box字段的多选 单选 筛选教程...

视频讲解:http://v.youku.com/v_show/id_XMjM5ODY1NDI4.html 讲的不好 大家凑合看吧

{php $theurl = “index.php?m=content&c=index&a=lists&catid=$catid”;}

{php $brandid = (isset($_GET[‘brandid’]) && is_numeric($_GET[‘brandid’]) ? $_GET[‘brandid’] : ”);}

{php $priceid = (isset($_GET[‘priceid’]) && is_numeric($_GET[‘priceid’]) ? $_GET[‘priceid’] : ”);}

{php $areaid = (isset($_GET[‘areaid’]) && is_numeric($_GET[‘areaid’]) ? $_GET[‘areaid’] : ”);}

{php $degree = (isset($_GET[‘degree’]) ? $_GET[‘degree’] : ”);}

{php $modelid_cache = getcache(‘model_field_’.$modelid,’model’);}

{php $brand_linkage = getcache(3360,’linkage’); $brand_data = $brand_linkage[data];}

{php $area_linkage = getcache(3379,’linkage’); $area_data = $area_linkage[data];}

$r){

if($r[parentid] == 0){

$boroughs[$k] = $r[‘name’];

}elseif(($_GET[areaid] == $r[‘parentid’] || $paid == $r[‘parentid’])){

$streets[$k] = $r[‘name’];

$areaid_arr[] = $k;

}

}

/**** 区域选项id处理结束 ****/

/**– 排序的数组 –**/

$order_arr = array(

‘finer’ => array(‘finer’=>’DESC’),

‘avgsort’ => array(‘avgsort’=>’DESC’),

‘reviews’ => array(‘reviews’=>’DESC’),

‘enjoy’ => array(‘enjoy’=>’DESC’),

‘price’ => array(‘avgprice’=>’DESC’),

‘price_s’ => array(‘avgprice’=>’ASC’),

‘picture’ => array(‘pictures’=>’DESC’),

‘picture_s’ => array(‘pictures’=>’ASC’),

‘addtime’ => array(‘addtime’=>’DESC’),

‘pageviews’ => array(‘pageviews’=>’DESC’),

);

/**– 查询的数组 –**/

$where = array();

if($catid) $where[‘catid’] = (int) $catid;

if($brandid) $where[‘brandid’] = (int) $brandid;

if($priceid) $where[‘priceid’] = (int) $priceid;

if($paid){

if($areaid) $where[‘areaid’] = (int) $areaid;

$areasql = ”;

}else{

if($areaid) $areasql = ‘ AND `areaid` IN(‘.join(‘,’,$areaid_arr).’)’;

}

function getwheresql($wheresqlarr) {

$result = $comma = ”;

if(empty($wheresqlarr)) {

$result = ‘1’;

} elseif(is_array($wheresqlarr)) {

foreach ($wheresqlarr as $key => $value) {

$result .= $comma.$key.’=\”.$value.’\”;

$comma = ‘ AND ‘;

}

} else {

$result = $wheresqlarr;

}

return $result;

}

$wheresql = getwheresql($where);

$wheresql .= $areasql;

//echo $wheresql;

?>

{php $data = explode(“\r\n”, $modelid_cache[‘priceid’][‘options’]);}

{php $price_arr = Array();}

价格 :

{if $priceid}

全部

{else}

全部

{/if}

{loop $data $r}

{php $r = explode(“|”,trim($r))}

{php $price_arr[$r[1]] = $r[0];}

{if $priceid == $r[1]}

{$r[0]}

{else}

{$r[0]}

{/if}

{/loop}

{php $data = explode(“\r\n”, $modelid_cache[‘degree’][‘options’]);}

学历 :

{if $degree}

全部

{else}

全部

{/if}

{loop $data $r}

{php $r = explode(“|”,trim($r))}

{if $degree == $r[1]}

{$r[0]}

{else}

{$r[0]}

{/if}

{/loop}

品牌 :

{if $brandid}

全部

{else}

全部

{/if}

{loop $brand_data $r}

{if $brandid == $r[linkageid]}

{$r[name]}

{else}

{$r[name]}

{/if}

{/loop}

商圈 :

{if $_GET[areaid]}

全部

{else}

全部

{/if}

{loop $boroughs $key $val}

{if $_GET[areaid] == $key || $paid == $key}

{$val}

{else}

{$val}

{/if}

{/loop}

{if $_GET[areaid]}

{loop $streets $key $val}

{if $_GET[areaid] == $key}

{$val}

{else}

{$val}

{/if}

{/loop}

{/if}

{pc:get sql=”SELECT * FROM v9_news WHERE $wheresql” cache=”3600″ num=”10″ page=”$page” return=”data”}

共找到 {php echo count($data);} 个结果

{loop $data $r}

{php $db = pc_base::load_model(‘hits_model’); $_r = $db->get_one(array(‘hitsid’=>’c-‘.$modelid.’-‘.$r[id])); $views = $_r[views]; }

{php $comment_tag = pc_base::load_app_class(“comment_tag”, “comment”); $comment_total = $comment_tag->count(array(‘commentid’=>’content_’.$catid.’-‘.$r[id].’-‘.$modelid));}

{date(‘Y-m-d H:i:s’,$r[inputtime])}·{$r[title]}

学历要求:{$r[degree]}

价格区间:[{$price_arr[$r[priceid]]}] 品牌:[{$brand_data[$r[brandid]][name]}] 区域:[{$area_data[$r[areaid]][name]}] 点击:{$views} 评论:{if $comment_total}{$comment_total}{else}0{/if}

{if $n%5==0}

{/if}

{/loop}

{$pages}

{/pc}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值