如何给dede分类信息的一二级地区分类设定不同样式
官方默认模板中的效果如图:
这样挤在一起很不好看,我现在想把“北京市”和后面的地区分别设定不同的样式,例如分成两块儿。织梦网络公司下面说下修改步骤。
一、先来查看代码:
分类信息列表页模板: /templets/default/list_infos.htm
模板处调用上面数据的代码是:
- {dede:infolink}
- <table id='dedeinfolink'>
- <tr>
- <td colspan='3' class='iftitle'>
- 信息附加条件:
- </td>
- </tr>
- <tr>
- <td width='50'> 地 区:</td>
- <td align='center' nowrap='yes'>
- <div>[field:linkallplace/]</div>
- </td>
- <td>
- [field:nativeplace /]
- </td>
- </tr>
- <tr><td colspan='3' class='spline'> </td></tr>
- <tr>
- <td> 类 型:</td>
- <td align='center' nowrap='yes'>
- <div>[field:linkalltype/]</div>
- </td>
- <td>
- [field:infotype /]
- </td>
- </tr>
- <tr><td colspan='3' class='spline'> </td></tr>
- </table>
- {/dede:infolink}
前台的html代码是:
- <table id='dedeinfolink'>
- <tr>
- <td colspan='3' class='iftitle'>
- 信息附加条件:
- </td>
- </tr>
- <tr>
- <td width='50'> 地 区:</td>
- <td align='center' nowrap='yes'>
- <div style="color:#FF0000; font-size:12px; font-weight:bold;"><a href='/plus/list.php?channelid=-8&tid=9&infotype=0'>不限</a></div>
- </td>
- <td>
- <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1000&infotype=0'> <b>北京市</b></a> >> <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1001&infotype=0'>东城区</a>
- <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1002&infotype=0'>西城区</a>
- <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1003&infotype=0'>崇文区</a>
- <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1004&infotype=0'>宣武区</a>
- <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1005&infotype=0'>朝阳区</a>
- <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1006&infotype=0'>丰台区</a>
- <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1007&infotype=0'>石景山区</a>
- <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1008&infotype=0'>海淀区</a>
- <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1009&infotype=0'>门头沟区</a>
- <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1010&infotype=0'>房山区</a>
- <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1011&infotype=0'>通州区</a>
- <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1012&infotype=0'>顺义区</a>
- <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1013&infotype=0'>昌平区</a>
- <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1014&infotype=0'>大兴区</a>
- <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1015&infotype=0'>怀柔区</a>
- <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1016&infotype=0'>平谷区</a>
- <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1017&infotype=0'>密云县</a>
- <a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1018&infotype=0'>延庆县</a>
-
- </td>
- </tr>
- <tr><td colspan='3' class='spline'> </td></tr>
- <tr>
- <td> 类 型:</td>
- <td align='center' nowrap='yes'>
- <div><a href='/plus/list.php?channelid=-8&tid=9&nativeplace=1000'>不限</a></div>
- </td>
- <td>
- <a href='/plus/list.php?channelid=-8&tid=9&infotype=500&nativeplace=1000'>商品</a>
- <a href='/plus/list.php?channelid=-8&tid=9&infotype=1000&nativeplace=1000'>租房</a>
- <a href='/plus/list.php?channelid=-8&tid=9&infotype=1500&nativeplace=1000'>交友</a>
- <a href='/plus/list.php?channelid=-8&tid=9&infotype=2000&nativeplace=1000'>招聘</a>
- <a href='/plus/list.php?channelid=-8&tid=9&infotype=2500&nativeplace=1000'>求职</a>
- <a href='/plus/list.php?channelid=-8&tid=9&infotype=3000&nativeplace=1000'>票务</a>
- <a href='/plus/list.php?channelid=-8&tid=9&infotype=3500&nativeplace=1000'>服务</a>
- <a href='/plus/list.php?channelid=-8&tid=9&infotype=4000&nativeplace=1000'>培训</a>
-
- </td>
- </tr>
- <tr><td colspan='3' class='spline'> </td></tr>
- </table>
内容分别对应相同部分的调用标签。知道了这个下面就可以来开始添加样式了。织梦网站建设为地区的二级分类写了个样式,让它好跟“北京市”分行分离开。样式为.ythwxb
二、开始添加样式。
打开控制分类信息标签的文件/include/taglib/infolink.lib.php
找到下面的代码:
- $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 rel="nofollow noopener noreferrer" href='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&nativeplace={$eid}&infotype={$infotype}'>{$em}</a>\r\n";
现在我们开始来添加html代码。
1、将>>修改为<div class=ythwxb>
2、打开 /templets/default/list_infos.htm 文件在代码:
- <tr>
- <td width='50'> 地 区:</td>
- <td align='center' nowrap='yes'>
- <div>[field:linkallplace/]</div>
- </td>
- <td>
- [field:nativeplace /]
- </td>
- </tr>
的[field:nativeplace /]后添加代码</div>即可。
保存文件,刷新页面。前台已经更改过来了。
以上就是[分类信息] 如何给dede分类信息的一二级地区分类设定不同样式。不用去羡慕别人的生活,有可能你此刻的生活却是另一个人梦寐以求的。更多关于[分类信息] 如何给dede分类信息的一二级地区分类设定不同样式请关注haodaima.com其它相关文章!