phpcms v9联动菜单实现筛选
<!--初始化init-->
{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];} <!-- 区域缓存 --> <!-- sql_条件-->
<?php
if($area_data[$_get[areaid]][parentid] == 0) {
$paid = 0;
} else {
$paid = $area_data[$_get[areaid]]['parentid'];
}
$areaid_arr = array();
$boroughs = $streets = '';
foreach($area_data as $k=>$r){
if($r[parentid] == 0){
$boroughs[$k] = $r['name'];
}elseif(($_get[areaid] == $r['parentid'] || $paid == $r['parentid'])){
$streets[$k] = $r['name'];
$areaid_arr[] = $k;
}
}
/**-- 排序的数组 --**/
$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();}
<div class="col-cate">
<b>价格 :</b> {if $priceid}
<a href="{url_par("brandid=$brandid&areaid=$areaid",$theurl)}" style="color:#6633ff;">全部</a>
{else}
<font style="color:#fff; background-color:#6633ff">全部</font>
{/if} {loop $data $r}
{php $r = explode("|",trim($r))}
{php $price_arr[$r[1]] = $r[0];}
{if $priceid == $r[1]}
<font style="color:#fff; background-color:#6633ff">{$r[0]}</font>
{else}
<a href='{url_par("brandid=$brandid&priceid=$r[1]&areaid=$areaid",$theurl)}'>{$r[0]}</a>
{/if}
{/loop}
</div> {php $data = explode("\r\n", $modelid_cache['degree']['options']);}
<div class="col-cate">
<b>学历 :</b> {if $degree}
<a href="{url_par("brandid=$brandid&priceid=$priceid&areaid=$areaid",$theurl)}" style="color:#6633ff;">全部</a>
{else}
<font style="color:#fff; background-color:#6633ff">全部</font>
{/if} {loop $data $r}
{php $r = explode("|",trim($r))}
{if $degree == $r[1]}
<font style="color:#fff; background-color:#6633ff">{$r[0]}</font>
{else}
<a href='{url_par("brandid=$brandid&priceid=$priceid°ree=$r[1]&areaid=$areaid",$theurl)}'>{$r[0]}</a>
{/if}
{/loop}
</div> <div class="col-cate">
<b>品牌 :</b>
{if $brandid}
<a href="{url_par("priceid=$priceid&areaid=$areaid",$theurl)}" style="color:#6633ff;">全部</a>
{else}
<font style="color:#fff; background-color:#6633ff">全部</font>
{/if}
{loop $brand_data $r}
{if $brandid == $r[linkageid]}
<font style="color:#fff; background-color:#6633ff">{$r[name]}</font>
{else}
<a href="{url_par("brandid=$r[linkageid]&priceid=$priceid&areaid=$areaid",$theurl)}">{$r[name]}</a>
{/if}
{/loop}
</div> <div class="col-cate">
<b>商圈 :</b>
{if $_get[areaid]}
<a href="{url_par("brandid=$brandid&priceid=$priceid",$theurl)}" style="color:#6633ff;">全部</a>
{else}
<font style="color:#fff; background-color:#6633ff">全部</font>
{/if}
{loop $boroughs $key $val}
{if $_get[areaid] == $key || $paid == $key}
<font style="color:#fff; background-color:#6633ff"> {$val}</font>
{else}
<a href="{url_par("brandid=$brandid&priceid=$priceid&areaid=$key",$theurl)}">{$val}</a>
{/if}
{/loop}
</div>
{if $_get[areaid]}
<div class="col_cate_2" style="padding:8px; border:1px solid #57a3c9; background-color:#eff5f8; margin-top:4px;">
{loop $streets $key $val}
{if $_get[areaid] == $key}
<font style="color:#fff; background-color:#6633ff"> {$val}</font>
{else}
<a href="{url_par("brandid=$brandid&priceid=$priceid&areaid=$key",$theurl)}">{$val}</a>
{/if}
{/loop}
</div>
{/if} {pc:get sql="select * from v9_news where $wheresql" cache="3600" num="10" page="$page" return="data"}
<h3 style="font-size:12px; color:#ff0000; line-height:22px; text-align:right;">共找到 {php echo count($data);} 个结果</h3>
<ul class="list lh24 f14" style="margin-top:12px;">
{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));} <li style="background-color:#f9f9f9; border-bottom:1px solid #999999; margin-top:4px;"><span class="rt">{date('y-m-d h:i:s',$r[inputtime])}</span>·<a href="{$r[url]}" target="_blank"{title_style($r[style])}>{$r[title]}</a>
<p><span style="font-size:11px; font-family:pmingliu; color:#666666;">学历要求:{$r[degree]}</span></p>
<p><span style="font-size:11px; font-family:pmingliu; color:#666666;">价格区间:<font style="font-family:verdana, arial, helvetica, sans-serif; font-size:10px;">[{$price_arr[$r[priceid]]}]</font> 品牌:<span {if $r[brandid] == $brandid} style="color:#f00;"{/if}>[{$brand_data[$r[brandid]][name]}] </span> 区域:[{$area_data[$r[areaid]][name]}] 点击:{$views} 评论:{if $comment_total}{$comment_total}{else}0{/if}</span></p>
</li>
{if $n%5==0}<li class="bk20 hr"></li>{/if}
{/loop}
</ul>
<div id="pages" class="text-c">{$pages}</div>
{/pc}
phpcms v9联动菜单实现筛选的更多相关文章
- phpcms v9联动菜单的调用方法_详解get_linkage函数
phpcms v9联动菜单调用方法[此为内容页调用方法]: {get_linkage($areaid,1,' >> ',1)} 显示效果: phpcms吧 >> 模板下载 &g ...
- phpcms V9 联动菜单的调用
/*********************************** 通过id获取显示联动菜单的 顶级父类的名称* @param $linkageid 联动菜单id* @param $keyi ...
- phpcms v9联动菜单的调用方法及get_linkage函数简单过程
{get_linkage($r['areaid'],1,' >> ',1)} 复制代码 当然这个 $r 也不是绝对的.要看你的loop 是如何写的. {loop $data $n $r} ...
- phpcms v9中模板标签使用及联动菜单
{template "content","header"} 调用根目录下phpcms\template\content\header文件 {charset} 字 ...
- PHPCMS联动菜单的调用函数get_linkage方法详解
v9联动菜单调用方法[注意此为内容页调用方法 {get_linkage($areaid,1,' >> ',1)} 显示效果: 湖北省 >> 武汉市 >> 汉阳区 [ ...
- phpcms v9为联动菜单字段添加验证提醒功能 解决标题不能为空
v9系统中,如果你在模型中添加了联动菜单字段就算你在字段设置中设置了最小值为1,提交内容之前你不选择联动菜单中的值,也不会出现类似类似“标题不能为空”这样的提示下面提供解决办法打开phpcms\lib ...
- phpcms v9 读取地区联动菜单缓存文件
读取缓存文件的方法是 getcache() 在 phpcms\libs\functions\global.func.php 中可找到. 地区联动菜单的缓存文件是 caches\caches_link ...
- phpcms v9教程 联动搜索在房地产网站开发中的应用
开发简述:使用phpcms v9系统,修改源文件5个,创建模型:楼盘.出售.出租.中介.小区,增加联动菜单:楼盘,增加用户组:房产中介.实现功能:游客发布信息.会员申请中介.楼盘全方位展示.报名团购. ...
- phpcms v9 下拉菜单 二级 三级子栏目调用方法
很多网站的导航栏可以实现下拉二级菜单,三级菜单等效果,今天我们就来分享phpcms v9 支持下拉菜单的方法,可以支持无限子栏目调用,具体写法如下: <ul> {pc:content ac ...
随机推荐
- 【HDOJ】2772 Matchsticks
纯粹的找规律题.1: 22: 53: 54: 45: 56: 67: 38: 79: 60: 6 2 1 13 7 74 4 115 2 ...
- 使用C#开发ActiveX控件 11
C#开发ActiveX控件 ActiveX 是一个开放的集成平台,为开发人员.用户和 Web生产商提供了一个快速而简便的在 Internet 和 Intranet 创建程序集成和内容的方法. 使用 ...
- Tuna项目总结
从8.19—9.13日一共四周的时间,我在Tuna项目组进行的我的第一次正式工作,以及学习.在此,我对这个阶段的工作及学习进行一个总结,主要分为对流程的理解和对自动化测试的应用两个方面. 在总结着两点 ...
- Sum Root to Leaf Numbers——LeetCode
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number ...
- DLL入门浅析(3)——从DLL中导出变量
转载自:http://www.cppblog.com/suiaiguo/archive/2009/07/20/90643.html 前面介绍了怎么从DLL中导出函数,下面我们来看一下如何从DLL中导出 ...
- Appium 环境搭建
1.安装nodejs 下载地址: http://nodejs.org/download/ 下载之后一路next就好. 验证是否安装成功: node -v
- Robot Framework安装配置 windows
1.install python https://www.python.org/downloads/release/python-279/ choose "Files" -> ...
- 注释PHP和html混合代码
<?php if(false){ ?> any code <?php } ?>
- 使用单例模式实现自己的HttpClient工具类
引子 在Android开发中我们经常会用到网络连接功能与服务器进行数据的交互,为此Android的SDK提供了Apache的HttpClient 来方便我们使用各种Http服务.你可以把HttpCli ...
- myqltransactionRollbackexception deadlock found when trying to get lock
linux 下远程连接mysq 命令: mysql -h "1.0.0.1" -u username -p 1 获 取锁等待情况 可以通过检查 table_locks_waited ...