phpwind 房产 数据来源 添加字段调用
2012-06-09 08:52
239 查看
phpwind 房产 数据来源 添加字段调用
系统自带的数据来源的调用字段无法满足我们实际网站需要调用的字段个数(前提是数据库有该字段)。
网上找了半天也没发现有人能解决该问题。官方也没出来个说法。所以得自己研究了。特提供出来大家一起学习。
例如
自带的新房数据来源所能所有字段如下
hid#4
url#index.php?m=house&q=info&hid=4
title#椒江荣安华府
name#椒江荣安华府
hits#84
aveprice#待定
value#0
area#椒江区
image#attachment/
opendate#6月下旬
state#新盘
test3/待定
但是缺少房产的详细地址字段值adress。需求是增加房产详细字段adress调用
步骤。
找到该数据来源文件
\mode\house\lib\areasource.class.php
比如我们要的是新房排序数据。所以定位61行。
到此我们可以发现该类的数据由$houseSortElementService->newHouse($area, $num,'area'); 获得,
继续定位\mode\house\lib\housesortelement.class.php 文件
发现12行
51行
由此我们定位到了要修改的地方。在此查询中并没有address 字段
既查询所有。你也可以将所需要的某个值添加进去。
到此前台数据源还调用不出address。还需要改一个地方。这个地方我找了另外个半天。就于自己技术有限。还需要漫长的路要走啊。感叹一下!!!
该位置在124行
终于完成。现在天台数据重新调用此就有显示了。
其他数据来源模型猜测也是类似。只要找到该数据来源的sortelement类
系统自带的数据来源的调用字段无法满足我们实际网站需要调用的字段个数(前提是数据库有该字段)。
网上找了半天也没发现有人能解决该问题。官方也没出来个说法。所以得自己研究了。特提供出来大家一起学习。
例如
自带的新房数据来源所能所有字段如下
hid#4
url#index.php?m=house&q=info&hid=4
title#椒江荣安华府
name#椒江荣安华府
hits#84
aveprice#待定
value#0
area#椒江区
image#attachment/
opendate#6月下旬
state#新盘
test3/待定
但是缺少房产的详细地址字段值adress。需求是增加房产详细字段adress调用
步骤。
找到该数据来源文件
\mode\house\lib\areasource.class.php
比如我们要的是新房排序数据。所以定位61行。
到此我们可以发现该类的数据由$houseSortElementService->newHouse($area, $num,'area'); 获得,
继续定位\mode\house\lib\housesortelement.class.php 文件
发现12行
function newHouse($round='',$num=0,$type='area',$hid=0) { return $this->getHouses($round,'opendate',$num,$type,$hid); }
51行
function getHouses($round,$order,$num,$type='area',$hid=0) { $num = (int) $num; !$num && $num = 10; $_sql_where = $this->getWhereSql($round,$type,'',$hid); $_sql_order = $this->getOrderSql($order); $temp = array(); $query = $this->_db->query("SELECT hid,name,logo,area,plate,status,aveprice,developer,opendate,isdimopendate,status,hits,groupbuynum,postnum,collectnum,score FROM pw_house_info $_sql_where $_sql_order ".S::sqlLimit(0,$num)); while ($rt = $this->_db->fetch_array($query)) { $temp[] = $this->_dataInit($rt); } return $temp; }
由此我们定位到了要修改的地方。在此查询中并没有address 字段
function getHouses($round,$order,$num,$type='area',$hid=0) { $num = (int) $num; !$num && $num = 10; $_sql_where = $this->getWhereSql($round,$type,'',$hid); $_sql_order = $this->getOrderSql($order); $temp = array(); $query = $this->_db->query("SELECT * FROM pw_house_info $_sql_where $_sql_order ".S::sqlLimit(0,$num)); while ($rt = $this->_db->fetch_array($query)) { $temp[] = $this->_dataInit($rt); } return $temp; }
既查询所有。你也可以将所需要的某个值添加进去。
到此前台数据源还调用不出address。还需要改一个地方。这个地方我找了另外个半天。就于自己技术有限。还需要漫长的路要走啊。感叹一下!!!
该位置在124行
function _dataInit($array) { global $houseBaseUrl; $data = array(); $data['hid'] = $array['hid']; $data['url'] = 'index.php?m=house&q=info&hid='.$array['hid']; $data['title'] = $array['name']; $data['name'] = $array['name']; $data['hits'] = $array['hits']; $data['address'] = $array['address']; $data['aveprice'] = $array['aveprice']; $data['value'] = $array['aveprice']; $data['area'] = $this->_getArea($array['area']); $data['image'] = $this->_getImageUrl($array['logo']); $array['opendate'] && $data['opendate'] = !$array['isdimopendate'] ? get_date($array['opendate'],'Y-n-j') : $this->_getDimDate($array['opendate']); $data['state'] = $this->_getStatus($array['status']); return $data; }此方法猜测就是对数据库拿出来的数据再处理存进data数组中。 我已经加入了
$data['address'] = $array['address'];address字段的处理。
终于完成。现在天台数据重新调用此就有显示了。
其他数据来源模型猜测也是类似。只要找到该数据来源的sortelement类
相关文章推荐
- phpwind 房产 数据来源经纪人数据 增加个人中介公司调用分类
- phpwind 二手房数据来源 添加 有无图片附件条件查询
- Discuz添加自定义数据调用模块
- 织梦添加和调用自定义字段的方法
- MySQL入门——修改数据表5:给指定表的指定字段添加外键约束
- SqlServer FOR XML PATH 将查询的每一行数据添加到一个字段中
- 将数据表中的字段添加到ComboBox控件
- 数据库导入/导出csv格式的数据文件+添加新的字段
- mongoose中如何给数据添加对应schema中没有的字段
- 使用 SELECT 语句从表中取数据 创建新表 字段属性 向表中添加数据 删除
- ArcEngine开发_添加字段,数据删除,插入,更新细节
- MySQL入门——数据表的修改1:往指定表中添加单列(字段)
- List添加Item时, 如何去判断某个字段, 并且保证字段数据不重复性
- DedeCMS添加自定义字段调用不出值的解决办法
- 黄聪:Jquery+DataTables插件,如何在ajax调用服务器数据后,自动给tr添加id属性
- SQL语句添加数据表字段
- 2.x的版本hive的api调用增加,删除,添加数据
- 建字段_添加数据_生成json.php
- 安卓SQLite 根据某一字段查询一条数据 根据某一字段排序 添加 修改 删除某一字段等于某某的那一条数据
- 更新ACCESS数据库出现“字段太小而不能接受所要添加的数据的数量。试着插入或粘贴较少的数据。”的解决方法