本帖最后由 aosoao 于 2012-3-20 01:07 编辑
请高手给一份修改2.1版,在首页会员卡商家处,显示地区分类下的商家的方法。
100金币悬赏,希望高手赐教!
就是首页的此处:
调用显示比如:商业街A区 的商家
最后首页就这样,每个下面可以显示所在地区的商家
修改方法原文地址:http://www.yousimei.com/forum.php?mod=viewthread&tid=4441&fromuid=1
1、需要修改index.php文件
if(!empty($url)) {
header("HTTP/1.1 301 Moved Permanently");
header("location: $url");
}
include template('templates/site/default/index.html.php', 1);
ob_out();
?>
在上面代码前添加下面代码:
//首页少儿用品店铺
$shaoeryongpin = array();
$query = DB::query("SELECT a.itemid,a.subject,b.ext_54 FROM ".DB::table('shopitems')." a LEFT JOIN ".DB::table('shopmessage')." b ON a.itemid =b.itemid WHERE a.itemid != '0' AND a.grade>2 AND a.region=164 AND (a.catid=158 or a.catid=159 or a.catid=160 or a.catid=161 or a.catid=165 or a.catid=157 or a.catid=156) ORDER BY a.itemid LIMIT 8");
while($row = DB::fetch($query)) {
$shaoeryongpin [$row['itemid']]['itemid'] = $row['itemid'];
$shaoeryongpin [$row['itemid']]['subject'] = cutstr($row['subject'],20,true);
$shaoeryongpin [$row['itemid']]['ext_54'] = $row['ext_54'];
}
//首页学校信息大全
$xuexiaoxinxidaquan = array();
$query = DB::query("SELECT a.itemid,a.subject,b.ext_54 FROM ".DB::table('shopitems')." a LEFT JOIN ".DB::table('shopmessage')." b ON a.itemid =b.itemid WHERE a.itemid != '0' AND a.grade>2 AND a.region=164 AND (a.catid=145 or a.catid=146 or a.catid=201) ORDER BY a.itemid LIMIT 8");
while($row = DB::fetch($query)) {
$xuexiaoxinxidaquan [$row['itemid']]['itemid'] = $row['itemid'];
$xuexiaoxinxidaquan [$row['itemid']]['subject'] = cutstr($row['subject'],20,true);
$xuexiaoxinxidaquan [$row['itemid']]['ext_54'] = $row['ext_54'];
}
//首页培训机构大全
$peixunjigou = array();
$query = DB::query("SELECT a.itemid,a.subject,b.ext_54 FROM ".DB::table('shopitems')." a LEFT JOIN ".DB::table('shopmessage')." b ON a.itemid =b.itemid WHERE a.itemid != '0' AND a.grade>2 AND a.region=164 AND (a.catid=194 or a.catid=195 or a.catid=196) ORDER BY a.itemid LIMIT 8");
while($row = DB::fetch($query)) {
$peixunjigou [$row['itemid']]['itemid'] = $row['itemid'];
$peixunjigou [$row['itemid']]['subject'] = cutstr($row['subject'],20,true);
$peixunjigou [$row['itemid']]['ext_54'] = $row['ext_54'];
}
//首页孕婴服务大全
$yunyingfuwu = array();
$query = DB::query("SELECT a.itemid,a.subject,b.ext_54 FROM ".DB::table('shopitems')." a LEFT JOIN ".DB::table('shopmessage')." b ON a.itemid =b.itemid WHERE a.itemid != '0' AND a.grade>2 AND a.region=164 AND (a.catid=192 ) ORDER BY a.itemid LIMIT 8");
while($row = DB::fetch($query)) {
$yunyingfuwu [$row['itemid']]['itemid'] = $row['itemid'];
$yunyingfuwu [$row['itemid']]['subject'] = cutstr($row['subject'],20,true);
$yunyingfuwu [$row['itemid']]['ext_54'] = $row['ext_54'];
}
//首页摄影录像其它
$shenyingluxiang = array();
$query = DB::query("SELECT a.itemid,a.subject,b.ext_54 FROM ".DB::table('shopitems')." a LEFT JOIN ".DB::table('shopmessage')." b ON a.itemid =b.itemid WHERE a.itemid != '0' AND a.grade>2 AND a.region=164 AND (a.catid=215 or a.catid=216 or a.catid=217 or a.catid=218 or a.catid=219 or a.catid=220) ORDER BY a.itemid LIMIT 8");
while($row = DB::fetch($query)) {
$shenyingluxiang [$row['itemid']]['itemid'] = $row['itemid'];
$shenyingluxiang [$row['itemid']]['subject'] = cutstr($row['subject'],20,true);
$shenyingluxiang [$row['itemid']]['ext_54'] = $row['ext_54'];
}
2、修改templates\site\default\index.html.php文件
<!--{if $_G['brandads']['enablediscount']}-->
<!--{template 'static/blockstyle/index_discount.html.php', 1}-->
<!--{ad/modulebanner/ad_module mbm/1}-->
<!--{/if}-->
<!--{if $_G['brandads']['enablehotgoods']}-->
<!--{template 'static/blockstyle/index_hotgoods.html.php', 1}-->
<!--{ad/modulebanner/ad_module mbm/2}-->
<!--{/if}-->
<!--{if $_G['brandads']['enableconsume']}-->
<!--{template 'static/blockstyle/index_consume.html.php', 1}-->
<!--{ad/modulebanner/ad_module mbm/3}-->
<!--{/if}-->
<!--{if $_G['brandads']['enablegroupbuy']}-->
<!--{template 'static/blockstyle/index_groupbuy.html.php', 1}-->
<!--{ad/modulebanner/ad_module/4}-->
<!--{/if}-->
在上面代码前添加下面代码:
<div class="mbox">
<div class="mbox_h"><h3>少儿用品店铺</h3></div>
<div class="mbox_c">
<ul class="plist plm cl">
<!--{if is_array($shaoeryongpin)}-->
<!--{loop $shaoeryongpin $id $shaoeryongpin}-->
<li>
<div class="thumb"><a target="_blank" href="store.php?id={$shaoeryongpin['itemid']}" title="{$shaoeryongpin['subject']}" ><img width="215" height="55" src="attachments/{$shaoeryongpin['ext_54']}" alt="{$shaoeryongpin['subject']}" /></a></div>
</li>
<!--{/loop}-->
<!--{/if}-->
<li>
<div class="thumb"><a target="_blank" href="store.php?id=412" title="优思美信息技术郑州办事处"><img width="215" height="55" src="attachments/2011/12/1_201112271441451xbxt.jpg" alt="优思美信息技术郑州办事处" /></a></div>
</li>
</ul>
</div>
</div>
<div class="mbox">
<div class="mbox_h"><h3>学校信息大全</h3></div>
<div class="mbox_c">
<ul class="plist plm cl">
<!--{if is_array($xuexiaoxinxidaquan)}-->
<!--{loop $xuexiaoxinxidaquan $id $xuexiaoxinxidaquan}-->
<li>
<div class="thumb"><a target="_blank" href="store.php?id={$xuexiaoxinxidaquan['itemid']}" title="{$xuexiaoxinxidaquan['subject']}" ><img width="215" height="55" src="attachments/{$xuexiaoxinxidaquan['ext_54']}" alt="{$xuexiaoxinxidaquan['subject']}" /></a></div>
</li>
<!--{/loop}-->
<!--{/if}-->
<li>
<div class="thumb"><a target="_blank" href="store.php?id=412" title="优思美信息技术郑州办事处"><img width="215" height="55" src="attachments/2011/12/1_201112271441451xbxt.jpg" alt="优思美信息技术郑州办事处" /></a></div>
</li>
</ul>
</div>
</div>
<div class="mbox">
<div class="mbox_h"><h3>培训机构大全</h3></div>
<div class="mbox_c">
<ul class="plist plm cl">
<!--{if is_array($peixunjigou)}-->
<!--{loop $peixunjigou $id $peixunjigou}-->
<li>
<div class="thumb"><a target="_blank" href="store.php?id={$peixunjigou['itemid']}" title="{$peixunjigou['subject']}" ><img width="215" height="55" src="attachments/{$peixunjigou['ext_54']}" alt="{$peixunjigou['subject']}" /></a></div>
</li>
<!--{/loop}-->
<!--{/if}-->
<li>
<div class="thumb"><a target="_blank" href="store.php?id=412" title="优思美信息技术郑州办事处"><img width="215" height="55" src="attachments/2011/12/1_201112271441451xbxt.jpg" alt="优思美信息技术郑州办事处" /></a></div>
</li>
</ul>
</div>
</div>
<div class="mbox">
<div class="mbox_h"><h3>孕婴服务大全</h3></div>
<div class="mbox_c">
<ul class="plist plm cl">
<!--{if is_array($yunyingfuwu)}-->
<!--{loop $yunyingfuwu $id $yunyingfuwu}-->
<li>
<div class="thumb"><a target="_blank" href="store.php?id={$yunyingfuwu['itemid']}" title="{$yunyingfuwu['subject']}" ><img width="215" height="55" src="attachments/{$yunyingfuwu['ext_54']}" alt="{$yunyingfuwu['subject']}" /></a></div>
</li>
<!--{/loop}-->
<!--{/if}-->
<li>
<div class="thumb"><a target="_blank" href="store.php?id=412" title="优思美信息技术郑州办事处"><img width="215" height="55" src="attachments/2011/12/1_201112271441451xbxt.jpg" alt="优思美信息技术郑州办事处" /></a></div>
</li>
</ul>
</div>
</div>
<div class="mbox">
<div class="mbox_h"><h3>摄影录像其它</h3></div>
<div class="mbox_c">
<ul class="plist plm cl">
<!--{if is_array($shenyingluxiang)}-->
<!--{loop $shenyingluxiang $id $shenyingluxiang}-->
<li>
<div class="thumb"><a target="_blank" href="store.php?id={$shenyingluxiang['itemid']}" title="{$shenyingluxiang['subject']}" ><img width="215" height="55" src="attachments/{$shenyingluxiang['ext_54']}" alt="{$shenyingluxiang['subject']}" /></a></div>
</li>
<!--{/loop}-->
<!--{/if}-->
<li>
<div class="thumb"><a target="_blank" href="store.php?id=412" title="优思美信息技术郑州办事处"><img width="215" height="55" src="attachments/2011/12/1_201112271441451xbxt.jpg" alt="优思美信息技术郑州办事处" /></a></div>
</li>
</ul>
</div>
</div>
上面代码中下面是放网站网店图片链接,也可以直接删除,删除后把查询返回结果数修改为3的倍数。
<li>
<div class="thumb"><a target="_blank" href="store.php?id=412" title="优思美信息技术郑州办事处"><img width="215" height="55" src="attachments/2011/12/1_201112271441451xbxt.jpg" alt="优思美信息技术郑州办事处" /></a></div>
</li>
3、修改templates\site\default\common.css如下面代码所示:
.plist { }
.plist li { float: left; margin-left:10px; _margin-left: 10px; display: inline; overflow: hidden; }
.plist img { }
.plist p, .plist span { display: block; width: 100%; height: 20px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.plist span, .plist span a { color: #EF8A25; }
.plist .thumb { width: 225px; height: 65px; border: 1px solid #EBEBEB; display: table-cell; vertical-align:middle; text-align: center; outline:none; *display: block; *font-size: 183px; *font-family:Arial; *line-height:0; overflow: hidden; cursor: pointer; }/*0.873*/
.plist .thumb a { }
.plist .thumb img{vertical-align:middle;}
.plm li { width: 227px; height: 81px; }
.plm .thumb { width: 225px; height: 65px; *font-size: 105px; } /* image 215x55 */
.plm .info { margin: 2px 0; height: 32px; line-height: 16px; overflow: hidden; white-space:inherit; }
.plb li { margin-left:15px; width: 222px; height: 196px; text-align: left; }
.plb .thumb { width: 220px; height: 140px; *font-size: 122px; } /* image 210x130 */
.plb .thumb img { max-width: 210px; max-height: 130px; width: expression(this.width > 210 && this.width>=this.height ? 210 : true); height: expression(this.height > 130 && this.width<=this.height ? 130 : true); }
4、完成以上修改后在更太更新一下缓存,大功告成。
我用的就是这个老大的方法,但是修改之后,首页能显示A区,就是调用不出来,哪位能指点下?
|