设为首页 加入收藏

TOP

DedeCms分类信息联动筛选,省级与地市分开联动
2011-08-21 04:35:41 来源: 作者: 【 】 浏览:378次 评论:0
 

DedeCms分类信息联动筛选,省级与地市分开联动

 

DedeCms分类信息联动筛选,省级与地市分开联动,注意:只适用于5.6版,其它版本没有测试,只应用于分类信息模型。其它联动可参照修改。

可能标题说的不是很清楚,下面以图为示例:

DedeCms分类信息联动筛选,省级与地市分开联动

如上图所示,默认是显示北京的区县,当点击上海市时,地市处显示上海的县区。这下大家伙明白了吧!

现在开始代码修改操作,只需要修改一个文件。

打开/include/taglib/infolink.lib.php,找到:

Copy to ClipboardLiehuo.Net Codes引用的内容:[www.veryhuo.com]
//地区链接
if(empty($nativeplace))
{
foreach($em_nativeplaces as $eid=>$em)
{
if($eid % 500 != 0) continue;
$fields['nativeplace'] .= " <a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&nativeplace={$eid}&infotype={$infotype}'>{$em}</a>\r\n";
}
}
else
{
$sontype = ( ($nativeplace % 500 != 0) ? $nativeplace : 0 );
$toptype = ( ($nativeplace % 500 == 0) ? $nativeplace : ( $nativeplace-($nativeplace%500) ) );
$fields['nativeplace'] = "<a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&nativeplace={$toptype}&infotype={$infotype}'><b>{$em_nativeplaces[$toptype]}</b></a> >> ";
foreach($em_nativeplaces as $eid=>$em)
{
if($eid < $toptype+1 || $eid > $toptype+499) continue;
if($eid == $nativeplace) {
$fields['nativeplace'] .= " <b>{$em}</b>\r\n";
}
else {
$fields['nativeplace'] .= " <a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&nativeplace={$eid}&infotype={$infotype}'>{$em}</a>\r\n";
}
}
}

把上面注释掉,然后在下面添加如下代码:

Copy to ClipboardLiehuo.Net Codes引用的内容:[www.veryhuo.com]
foreach($em_nativeplaces as $eid=>$em)
{
if($eid % 500 != 0) continue;
$fields['nativeplace'] .= " <a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&nativeplace={$eid}'>{$em}</a>\r\n";
}
//地区链接
if(empty($nativeplace))
{
foreach($em_nativeplaces as $eid=>$em)
{
if($eid > 999 ) continue;
$fields['diqu'] .= " <a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&nativeplace={$eid}'>{$em}</a>\r\n";
}

}
else
{
$sontype = ( ($nativeplace % 500 != 0) ? $nativeplace : 0 );
$toptype = ( ($nativeplace % 500 == 0) ? $nativeplace : ( $nativeplace-($nativeplace%500) ) );

foreach($em_nativeplaces as $eid=>$em)
{
if($eid < $toptype+1 || $eid > $toptype+499) continue;
if($eid == $nativeplace) {
$fields['diqu'] .= " <b><a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&nativeplace={$nativeplace}'>{$em}</a></b>\r\n";
}
else {
$fields['diqu'] .= " <a href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&nativeplace={$eid}'>{$em}</a>\r\n";
}
}
}

保存就可以了。谢谢阅读烈火网提供的DedeCMS教程。

 
 
85.7% (6)
 
14.3% (1)
Tag标签:DEDECMS 分类信息 联动菜单
本文编辑:柳絮随风
 
  • 下一篇:DedeCms 三级栏目获取当前效果解决方法
  • 更多..

    网友评论

     
     
    发表评论(拉取统计信息……)
    用户名: 验证码:点击更换
     
    超过 人围观,
    您看到此篇文章时的感受是:
    Tags: 责任编辑:administrator
    】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
    分享到QQ空间
    分享到: 
    上一篇DedeCms 三级栏目获取当前效果解.. 下一篇PHPCMS V9删除文章出错 MySQL Que..

    评论

    帐  号: 密码: (新用户注册)
    验 证 码:
    表  情:
    内  容:

    相关栏目

    最新文章

    图片主题

    热门文章

    推荐文章

    相关文章

    广告位