本帖最后由 dongdong0925 于 2011-6-13 16:23 编辑
附近房源确实是不支持{subject}的。
具体见function_category.php文件,代码如下。- function neighborhood($tid, $sortid, $cityid, $districtid, $streetid, $sortoptionarray, $template, $modurl) {
- global $_G;
- $optionlist = $data = $datalist = $searchvalue = $searchunit = $stemplate = $imagelist = $_G['optionvaluelist'] = array();
- $valuefield = '';
- foreach($sortoptionarray as $optionid => $option) {
- if($option['visitedshow']) {
- $valuefield .= ','.$option['identifier'];
- $optionlist[$option['identifier']]['unit'] = $option['unit'];
- $searchvalue[] = '/\[('.$option['identifier'].')value\]/e';
- $searchunit[] = '/\[('.$option['identifier'].')unit\]/e';
- $optionlist['attachid'] = '';
- }
- }
- $query = DB::query("SELECT tid, attachid $valuefield FROM ".DB::table('category_sortvalue')."$sortid WHERE city='$cityid' AND district='$districtid' AND street='$streetid' AND tid!='$tid' ORDER BY dateline DESC LIMIT 5");
- while($thread = DB::fetch($query)) {
- foreach($optionlist as $identifier => $option) {
- $_G['optionvaluelist'][$thread['tid']][$identifier]['unit'] = $option['unit'];
- $_G['optionvaluelist'][$thread['tid']][$identifier]['value'] = $thread[$identifier];
- if($identifier == 'attachid') {
- $imagelist[$thread['tid']] = $thread['attachid'] ? '<img src="'.getcateimg($thread['attachid'], 0, 48, 48).'">' : '<img src="template/default/category/images/noupload.gif" width="48" height="48">';
- } else {
- $data[$thread['tid']] = $thread['tid'];
- }
- }
- }
- foreach($data as $tid => $option) {
- $datalist[$tid] = preg_replace(array("/\{image\}/i", "/\[url\](.+?)\[\/url\]/i"),
- array($imagelist[$tid], "<a href="$modurl?mod=view&tid=$tid">\\1</a>"
- ), stripslashes($template));
- $datalist[$tid] = preg_replace($searchvalue, "showlistoption('\\1', 'value', '$tid')", $datalist[$tid]);
- $datalist[$tid] = preg_replace($searchunit, "showlistoption('\\1', 'unit', '$tid')", $datalist[$tid]);
- }
- return $datalist;
- }
复制代码
其中- $datalist[$tid] = preg_replace(array("/\{image\}/i", "/\[url\](.+?)\[\/url\]/i"),
复制代码 为解析{image}标签。
|