如何給dede分類信息的一二級地區分類設定不同樣式
官方默認模板中的效果如圖:
這樣擠在一起很不好看,我現在想把“北京市”和后面的地區分別設定不同的樣式,例如分成兩塊兒。織夢網絡公司跟板網下面說下修改步驟。
一、先來查看代碼:
分類信息列表頁模板: /templets/default/list_infos.htm
模板處調用上面數據的代碼是:
-
{dede:infolink}
-
<tableid='dedeinfolink'>
-
<tr>
-
<tdcolspan='3'class='iftitle'>
-
信息附加條件:
-
</td>
-
</tr>
-
<tr>
-
<tdwidth='50'> 地區:</td>
-
<tdalign='center'nowrap='yes'>
-
<div>[field:linkallplace/]</div>
-
</td>
-
<td>
-
[field:nativeplace/]
-
</td>
-
</tr>
-
<tr><tdcolspan='3'class='spline'> </td></tr>
-
<tr>
-
<td> 類型:</td>
-
<tdalign='center'nowrap='yes'>
-
<div>[field:linkalltype/]</div>
-
</td>
-
<td>
-
[field:infotype/]
-
</td>
-
</tr>
-
<tr><tdcolspan='3'class='spline'> </td></tr>
-
</table>
-
{/dede:infolink}
前臺的html代碼是:
-
<tableid='dedeinfolink'>
-
<tr>
-
<tdcolspan='3'class='iftitle'>
-
信息附加條件:
-
</td>
-
</tr>
-
<tr>
-
<tdwidth='50'> 地區:</td>
-
<tdalign='center'nowrap='yes'>
-
<divstyle="color:#FF0000;font-size:12px;font-weight:bold;"><ahref='/plus/list.php?channelid=-8&tid=9&infotype=0'>不限</a></div>
-
</td>
-
<td>
-
<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1000&infotype=0'><b>北京市</b></a>>><ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1001&infotype=0'>東城區</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1002&infotype=0'>西城區</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1003&infotype=0'>崇文區</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1004&infotype=0'>宣武區</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1005&infotype=0'>朝陽區</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1006&infotype=0'>豐臺區</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1007&infotype=0'>石景山區</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1008&infotype=0'>海淀區</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1009&infotype=0'>門頭溝區</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1010&infotype=0'>房山區</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1011&infotype=0'>通州區</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1012&infotype=0'>順義區</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1013&infotype=0'>昌平區</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1014&infotype=0'>大興區</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1015&infotype=0'>懷柔區</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1016&infotype=0'>平谷區</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1017&infotype=0'>密云縣</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1018&infotype=0'>延慶縣</a>
-
-
</td>
-
</tr>
-
<tr><tdcolspan='3'class='spline'> </td></tr>
-
<tr>
-
<td> 類型:</td>
-
<tdalign='center'nowrap='yes'>
-
<div><ahref='/plus/list.php?channelid=-8&tid=9&nativeplace=1000'>不限</a></div>
-
</td>
-
<td>
-
<ahref='/plus/list.php?channelid=-8&tid=9&infotype=500&nativeplace=1000'>商品</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&infotype=1000&nativeplace=1000'>租房</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&infotype=1500&nativeplace=1000'>交友</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&infotype=2000&nativeplace=1000'>招聘</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&infotype=2500&nativeplace=1000'>求職</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&infotype=3000&nativeplace=1000'>票務</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&infotype=3500&nativeplace=1000'>服務</a>
-
<ahref='/plus/list.php?channelid=-8&tid=9&infotype=4000&nativeplace=1000'>培訓</a>
-
-
</td>
-
</tr>
-
<tr><tdcolspan='3'class='spline'> </td></tr>
-
</table>
內容分別對應相同部分的調用標簽。知道了這個下面就可以來開始添加樣式了。織夢網站建設跟板網為地區的二級分類寫了個樣式,讓它好跟“北京市”分行分離開。樣式為.ythwxb 二、開始添加樣式。 打開控制分類信息標簽的文件/include/taglib/infolink.lib.php 找到下面的代碼:
-
$fields['nativeplace']="<ahref='{$baseurl}plus/list.php?channelid={$channelid}&tid={$typeid}&nativeplace={$toptype}&infotype={$infotype}'><b>{$em_nativeplaces[$toptype]}</b></a>>>";
-
foreach($em_nativeplacesas$eid=>$em)
-
{
-
if($eid<$toptype+1||$eid>$toptype+499)continue;
-
if($eid==$nativeplace){
-
$fields['nativeplace'].="<b>{$em}</b>\r\n";
-
}
-
else{
-
$fields['nativeplace'].="<ahref='{$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>
-
<tdwidth='50'>地區:</td>
-
<tdalign='center'nowrap='yes'>
-
<div>[field:linkallplace/]</div>
-
</td>
-
<td>
-
[field:nativeplace/]
-
</td>
-
</tr>
的[field:nativeplace /]后添加代碼</div>即可。 保存文件,刷新頁面。前臺已經更改過來了。