点击登录
  • 欢迎访问无限星辰技术博客,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏无限星辰吧
  • 好集导航开张了,传送门:好集导航

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

Phpcms知识库 crx349 22856次浏览 0个评论 扫描二维码

房产演示

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

文章筛选演示

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}

list_test


无限星辰 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明phpcms V9二次开发之联动菜单筛选 包括box字段的多选 单选 筛选教程!
喜欢 (13)
[]
分享 (0)

您必须 登录 才能发表评论!