开发简述:使用phpcms v9系统,修改源文件5个,创建模型:楼盘、出售、出租、中介、小区,增加联动菜单:楼盘,增加用户组:房产中介。
实现功能:
游客发布信息、会员申请中介、楼盘全方位展示、报名团购、看房功能,发布信息时可根据登陆后的会员资料自动填好联系信息,中介有自己的店铺,可给中介留言,联动筛选搜索、排序,房源对比功能。
联动筛选搜索功能的实现方法及代码:
要修改的文件就是list.html模板
核心代码:
<?php
$theurl = app_path."index.php?m=content&c=index&a=lists&catid=$catid";
$where = "status=99";
$orderby = "";
foreach ($_get as $field => $r) {
if($r) {
if(!in_array($field,array('m','c','a','page'))){
if(strrpos($field,'_')){
$arr=explode("-",$r);
$field = str_replace('_','',$field);
$where .= " and $field >= '$arr[0]' and $field <= '$arr[1]'";
}else if($field == 'title'){
$where .= " and $field like "."'%".$r."%'";
}else if($field == 'orderby'){
$orderby = str_replace('_',' ',$r);
}else{
$where .= " and $field='$r'";
}
}
}
}
//if($where)$where = substr($where,5);
if(!$orderby)$orderby = "id desc";
?>
用这段代码来构造查询条件和排序方式,有了这段代码之后,要把list.htm获得列表的pc语句改造成这样
原来的
{pc:content action="lists" cat /></span></form>