主页 > 网站建设 > 建站知识 > [分类信息] 如何给dede分类信息的一二级地区分类

[分类信息] 如何给dede分类信息的一二级地区分类

POST TIME:2017-11-13 14:39

如何给dede分类信息的一二级地区分类设定不同样式
官方默认模板中的效果如图:
这样挤在一起很不好看,我现在想把“北京市”和后面的地区分别设定不同的样式,例如分成两块儿。织梦网络公司跟板网下面说下修改步骤。
一、先来查看代码:
分类信息列表页模板: /templets/default/list_infos.htm
模板处调用上面数据的代码是:


  1. {dede:infolink}
  2. <tableid='dedeinfolink'>
  3. <tr>
  4. <tdcolspan='3'class='iftitle'>
  5. 信息附加条件:
  6. </td>
  7. </tr>
  8. <tr>
  9. <tdwidth='50'>&nbsp;地区:</td>
  10. <tdalign='center'nowrap='yes'>
  11. <div>[field:linkallplace/]</div>
  12. </td>
  13. <td>
  14. [field:nativeplace/]
  15. </td>
  16. </tr>
  17. <tr><tdcolspan='3'class='spline'>&nbsp;</td></tr>
  18. <tr>
  19. <td>&nbsp;类型:</td>
  20. <tdalign='center'nowrap='yes'>
  21. <div>[field:linkalltype/]</div>
  22. </td>
  23. <td>
  24. [field:infotype/]&nbsp;
  25. </td>
  26. </tr>
  27. <tr><tdcolspan='3'class='spline'>&nbsp;</td></tr>
  28. </table>
  29. {/dede:infolink}

前台的html代码是:


  1. <tableid='dedeinfolink'>
  2. <tr>
  3. <tdcolspan='3'class='iftitle'>
  4. 信息附加条件:
  5. </td>
  6. </tr>
  7. <tr>
  8. <tdwidth='50'>&nbsp;地区:</td>
  9. <tdalign='center'nowrap='yes'>
  10. <divstyle="color:#FF0000;font-size:12px;font-weight:bold;"><ahref='/plus/list.php?channelid=-8&tid=9&infotype=0'>不限</a></div>
  11. </td>
  12. <td>
  13. <ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1000&infotype=0'><b>北京市</b></a>&gt;&gt;<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1001&infotype=0'>东城区</a>
  14. <ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1002&infotype=0'>西城区</a>
  15. <ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1003&infotype=0'>崇文区</a>
  16. <ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1004&infotype=0'>宣武区</a>
  17. <ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1005&infotype=0'>朝阳区</a>
  18. <ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1006&infotype=0'>丰台区</a>
  19. <ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1007&infotype=0'>石景山区</a>
  20. <ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1008&infotype=0'>海淀区</a>
  21. <ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1009&infotype=0'>门头沟区</a>
  22. <ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1010&infotype=0'>房山区</a>
  23. <ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1011&infotype=0'>通州区</a>
  24. <ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1012&infotype=0'>顺义区</a>
  25. <ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1013&infotype=0'>昌平区</a>
  26. <ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1014&infotype=0'>大兴区</a>
  27. <ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1015&infotype=0'>怀柔区</a>
  28. <ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1016&infotype=0'>平谷区</a>
  29. <ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1017&infotype=0'>密云县</a>
  30. <ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1018&infotype=0'>延庆县</a>
  31. &nbsp;
  32. </td>
  33. </tr>
  34. <tr><tdcolspan='3'class='spline'>&nbsp;</td></tr>
  35. <tr>
  36. <td>&nbsp;类型:</td>
  37. <tdalign='center'nowrap='yes'>
  38. <div><ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1000'>不限</a></div>
  39. </td>
  40. <td>
  41. <ahref='/plus/list.php?channelid=-8&tid=9&infotype=500&nativeplace=1000'>商品</a>
  42. <ahref='/plus/list.php?channelid=-8&tid=9&infotype=1000&nativeplace=1000'>租房</a>
  43. <ahref='/plus/list.php?channelid=-8&tid=9&infotype=1500&nativeplace=1000'>交友</a>
  44. <ahref='/plus/list.php?channelid=-8&tid=9&infotype=2000&nativeplace=1000'>招聘</a>
  45. <ahref='/plus/list.php?channelid=-8&tid=9&infotype=2500&nativeplace=1000'>求职</a>
  46. <ahref='/plus/list.php?channelid=-8&tid=9&infotype=3000&nativeplace=1000'>票务</a>
  47. <ahref='/plus/list.php?channelid=-8&tid=9&infotype=3500&nativeplace=1000'>服务</a>
  48. <ahref='/plus/list.php?channelid=-8&tid=9&infotype=4000&nativeplace=1000'>培训</a>
  49. &nbsp;
  50. </td>
  51. </tr>
  52. <tr><tdcolspan='3'class='spline'>&nbsp;</td></tr>
  53. </table>

内容分别对应相同部分的调用标签。知道了这个下面就可以来开始添加样式了。织梦网站建设跟板网为地区的二级分类写了个样式,让它好跟“北京市”分行分离开。样式为.ythwxb 二、开始添加样式。 打开控制分类信息标签的文件/include/taglib/infolink.lib.php 找到下面的代码:


  1. $fields['nativeplace']="<ahref='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&nativeplace={$toptype}&infotype={$infotype}'><b>{$em_nativeplaces[$toptype]}</b></a>&gt;&gt;";
  2. foreach($em_nativeplacesas$eid=>$em)
  3. {
  4. if($eid<$toptype+1||$eid>$toptype+499)continue;
  5. if($eid==$nativeplace){
  6. $fields['nativeplace'].="<b>{$em}</b>\r\n";
  7. }
  8. else{
  9. $fields['nativeplace'].="<ahref='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&nativeplace={$eid}&infotype={$infotype}'>{$em}</a>\r\n";

现在我们开始来添加html代码。 1、将&gt;&gt;修改为<div class=ythwxb> 2、打开 /templets/default/list_infos.htm 文件在代码:


  1. <tr>
  2. <tdwidth='50'>地区:</td>
  3. <tdalign='center'nowrap='yes'>
  4. <div>[field:linkallplace/]</div>
  5. </td>
  6. <td>
  7. [field:nativeplace/]
  8. </td>
  9. </tr>

的[field:nativeplace /]后添加代码</div>即可。 保存文件,刷新页面。前台已经更改过来了。



收缩
  • 微信客服
  • 微信二维码
  • 电话咨询

  • 400-1100-266