欢迎来到258分享网,纯净的网络源码分享基地!

258资源分享网

全部作品
全部作品
网站源码
微信源码
素材特效
源码插件
视频教程
建站学院
热门搜索: 织梦  农业种植  农业  安全设置  官方
258资源分享 > 建站学院 > 织梦教程 > DedeCms分类信息联动筛选,省级与地市分开联动

推荐下载

HTML5响应式自适应网咯设计

2020-05-12   浏览:740

高端HTML5响应式企业通用网

2020-05-06   浏览:521

html5响应式外贸网站英文版

2020-05-08   浏览:510

HTML5自适应律师工作室类网

2020-04-04   浏览:504

HTML5影视传媒文化公司类网

2020-05-12   浏览:502

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

发布时间:2020-04-15  

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

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

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

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

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

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

Copy to Clipboard引用的内容:[]

//地区链接 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引用的内容:[] 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"; } } }