编辑整理:整理来源:百度知道,浏览量:67,时间:2023-02-26 13:30:01
phpcms二次开发下载镜像,php 开源cms,phpcms安装
php来自cms v9二次开发教程之联动搜索在房地产网站开发中的应用
开发简磁述:使用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($f火笔感液官血销早六ield,'_')){
$arr=explode("-",$r)响屋去似货发士;
$field = s海tr_replace('_','',$field);
$where .= " AND $field >= '$arr[0]' AND $field <= 审鲜律粉境电随王'$arr[1]'";
}else if($field == 'title'){
$where .= " AND $field LIKE "."'%".$r."%'";
}else if($field == 'or书岁远责既记出derby'){
$orderby = str_replace('_较至印然办促香丝场',' ',$r);
}else{
$where .= " AND $field=果敌述增球液'$r'";
}
}
}
}
//if($where)$where = substr($where,刚5);
if(!$orderby)$orde映律rby = "id desc";
?>
用这段代码来构造药随士态境飞首造查询条件和排序方式,有了这段代码之后,要把list.htm获得列表的pc语句其照督胶倒血映注哥虽病改造成这样
原来的
{pc:胞质氢content actio威新药均妈n="lists" catid="$catid" num="25" order="id DESC" page="$page"}
改造后的
{pc:con面武宣五击管规常际重得tent action="lists" where="$where" catid="$catid" num="25" order="$orderby" page="$page"}
使用的时候就比较麻烦了
<p><span>状态:</span><span><a href='{url_par("price_=$_GET[price_]&hstatus=& typeid=$_GET[typeid]&address=$_GET[address]",$theurl)}'>全部</a& amp; gt;</span>
<span {if $_GET[hstatus] == 1}class='shaixuan'{/if}><a href='{url_par("price_=$_GET[price_]&hstatus=1& typeid=$_GET[typeid]&address=$_GET[address]",$theurl)}'>新盘</a& amp; gt;</span>
<span {if $_GET[hstatus] == 2}class='shaixuan'{/if}><a href='{url_par("price_=$_GET[price_]&hstatus=2& typeid=$_GET[typeid]&address=$_GET[address]",$theurl)}'>在售</a& amp; gt;</span>
<span {if $_GET[hstatus] == 3}class='shaixuan'{/if}><a href='{url_par("price_=$_GET[price_]&hstatus=3& typeid=$_GET[typeid]&address=$_GET[address]",$theurl)}'>尾盘</a& amp; gt;</span>
<span {if $_GET[hstatus] == 4}class='shaixuan'{/if}><a href='{url_par("price_=$_GET[price_]&hstatus=4& typeid=$_GET[typeid]&address=$_GET[address]",$theurl)}'>售完</a& amp; gt;</span></p>
<p><span>均价:</span><span><a href='{url_par("price_=&hstatus=$_GET[hstatus]& typeid=$_GET[typeid]&address=$_GET[address]",$theurl)}'>全部</a& amp; gt;</span>
<span {if $_GET[price_] == '0-4000'}class='shaixuan'{/if}><a href='{url_par("price_=0-4000&hstatus=$_GET[hstatus]& typeid=$_GET[typeid]&address=$_GET[address]",$theurl)}'>4000以下& amp; lt;/a></span>
<span {if $_GET[price_] == '4000-5000'}class='shaixuan'{/if}><a href='{url_par("price_=4000-5000&typeid=$_GET[typeid]&hstatus=$_GET[hstatus]&address=$_GET[address]",$theurl)}'>4000-5000</a></span>
<span {if $_GET[price_] == '5000-6000'}class='shaixuan'{/if}><a href='{url_par("price_=5000-6000&hstatus=$_GET[hstatus]&typeid=$_GET[typeid]&address=$_GET[address]",$theurl)}'>5000-6000</a></span>
<span {if $_GET[price_] == '6000-7000'}class='shaixuan'{/if}><a href='{url_par("price_=6000-7000&hstatus=$_GET[hstatus]&typeid=$_GET[typeid]&address=$_GET[address]",$theurl)}'>6000-7000</a></span>
<span {if $_GET[price_] == '7000-8000'}class='shaixuan'{/if}><a href='{url_par("price_=7000-8000&hstatus=$_GET[hstatus]&typeid=$_GET[typeid]&address=$_GET[address]",$theurl)}'>7000-8000</a></span>
<span {if $_GET[price_] == '8000-9000'}class='shaixuan'{/if}><a href='{url_par("price_=8000-9000&hstatus=$_GET[hstatus]&typeid=$_GET[typeid]&address=$_GET[address]",$theurl)}'>8000-9000</a></span>
<span {if $_GET[price_] == '9000-10000'}class='shaixuan'{/if}><a href='{url_par("price_=9000-10000&hstatus=$_GET[hstatus]&typeid=$_GET[typeid]&address=$_GET[address]",$theurl)}'>9000-10000</a></span>
<span {if $_GET[price_] == '10000-100000'}class='shaixuan'{/if}><a href='{url_par("price_=10000-100000&hstatus=$_GET[hstatus]& typeid=$_GET[typeid]&address=$_GET[address]",$theurl)}'>10000以上& amp; lt;/a></span>
</p>
<p><span>类型:</span><span><a href="{url_par("price_=$_GET[price_]&hstatus=$_GET[hstatus]& typeid=&address=$_GET[address]",$theurl)}">全部</a></span& amp; gt;
{pc:get sql="SELECT * FROM `v9house_type` where `module`='content'"}
{loop $data $key $val}
<span {if $_GET[typeid] == $val[typeid]}class='shaixuan'{/if}><a href="{url_par("price_=$_GET[price_]&hstatus=$_GET[hstatus]&typeid=$val[typeid]&address=$_GET[address]",$theurl)}">{$val[name]}</a></span>
{/loop}
{/pc}</p>
<p><span>地区:</span>
<span><a href="{url_par("price_=$_GET[price_]&hstatus=$_GET[hstatus]& typeid=$_GET[typeid]&address=",$theurl)}">全部</a></span& amp; gt;
{pc:get sql="SELECT linkageid,name FROM `v9house_linkage` where parentid=(SELECT linkageid FROM `v9house_linkage` where name='淄博市')"}
{loop $data $key $val}
<span {if $_GET[address] == $val[linkageid]}class='shaixuan'{/if}> <a href="{url_par("price_=$_GET[price_]&hstatus=$_GET[hstatus]&typeid=$_GET[typeid]&address=$val[linkageid]",$theurl)}">{$val[name]}</a></span>
{/loop}
{/pc}</p>
没办法,要想联动,就得每次都传递出所有需要联动的参数,所以url的参数部分就很多,容易晕掉~
获取搜索结果的代码是
共返回 {php echo count($data);} 个结果
放在
{pc:content action="lists" where="$where" catid="$catid" num="25" order="$orderby" page="$page"}
下面
loop
的上面
共返回 {php echo count($data);} 个结果
排序的参数也很麻烦
<a href='{url_par("price_=$_GET[price_]&area_=$_GET[area_]& shi=$_GET[shi]&typeid=$_GET[typeid]&address=$_GET[address]& orderby=area_desc",$theurl)}'>面积</a>
基本就这样了,希望有人能看懂
搜索表单也可以直接用在这里
给个例子
<form name="myform1" method="get" action="">
<input type="hidden" name="m" value="content">
<input type="hidden" name="c" value="index">
<input type="hidden" name="a" value="lists">
<span><select name="catid">
<option value="6">出售</option>
<option value="12">求购</option>
</select></span>
<span><select name="area_">
<option value="">面积不限</option>
<option value="0-50">小于50</option>
<option value="50-80">50到80</option>
<option value="80-120">80到120</option>
<option value="120-200">120到200</option>
<option value="200-10000">大于200</option>
</select></span>
<span><select name="shi">
<option value="">所有户型</option>
<option value="1">1室</option>
<option value="2">2室</option>
<option value="3">3室</option>
</select></span>
<span><input name="title" type="text" class="text4" style="width:60px;" /></span>
<span><input type="submit" value="" class="text3" /></span></form>
phpcms二次开发下载镜像,php 开源cms,phpcms安装
作者:整理来源:百度知道,时间:2023-02-26 13:30,浏览:68