Destoon · 2018年06月6号 0

destoon首页完美调用行业类别的三级分类方法

先看效果

destoon首页完美调用行业类别的三级分类方法

首先找到根目录下的template\default\chip\catalog.htm的文件

把他改为:

{if !$DT[page_bigcat]}
<table width=”100%” cellpadding=”0″ cellspacing=”0″>
{php $child = get_maincat(0, $mid, 1);}
{loop $child $i $c}
{if $i%2==1}<tr{if $i%2==1} bgcolor=”#F9F9F9″{/if}>{/if}
<td valign=”top” width=”3%” class=”catalog_tds”>
<p>
<a href=”{$MODULE[$mid][linkurl]}{$c[linkurl]}” target=”_blank” class=”px15″><strong>{set_style($c[catname], $c[style])}</strong></a>
{if $c[child]}
{php $sub = get_maincat($c[catid], $mid, 2);}
{loop $sub $j $s}{if $j < 5} <a href=”{$MODULE[$mid][linkurl]}{$s[linkurl]}” target=”_blank”><strong>{set_style($s[catname], $s[style])}</strong></a>{/if}{/loop}
{/if}
</p>
</td>
<td valign=”top” width=”97%” class=”catalog_tds”>
{if $c[child]}
{php $sub = get_maincat($c[catid], $mid, 1);}

{loop $sub $j $s}
<ul>
<li>
<a style=”color:#CC0000; font-weight:bold;” href=”{$MODULE[$mid][linkurl]}{$s[linkurl]}” target=”_blank” class=”g”>{set_style($s[catname], $s[style])}</a>
</li>

{if $s[child]}
  {php $sub = get_maincat($s[catid], $CATEGORY, 2);}
  {loop $sub $k $l}
  {if $j < 5}
  <li> <a href=”{$MODULE[$mid][linkurl]}{$l[linkurl]}” target=”_blank”><strong>{set_style($l[catname], $l[style])}</strong></a></li>{/if}
  {/loop}
  {/if}   
     {if $s[child]}
     {php $sub = get_maincat($s[catid], $CATEGORY, 1);}    
    {loop $sub $k $l}{if $k < 8}
          <li><a href=”{$MODULE[$mid][linkurl]}{$l[linkurl]}” target=”_blank” class=”g”>{set_style($l[catname], $l[style])}</a></li>{/if}
     {/loop}
     <div style=”clear:both;”></div>
    {/if}
 

   </ul>
{/loop}
{if $j>8}<li><a href=”{$MODULE[$mid][linkurl]}{$c[linkurl]}” target=”_blank” class=”g”>更多</a></li>{/if}

<div class=”c_b”></div>
{/if}
</td>
{if $i%2==1}</tr>{/if}
{/loop}
</table>
{else}
{php $BIG = explode(‘|’, $DT[page_bigcat]);}
{loop $BIG $kkk $vvv}
{if $kkk}<div class=”b5 c_b”></div>{/if}
<div class=”catalog_on_1″ onmouseover=”this.className=’catalog_on_2′;” onmouseout=”this.className=’catalog_on_1′;”>
<table width=”100%” cellspacing=”2″ cellspacing=”2″>
<tr>
<td class=”catalog_tdl”>{$vvv}</td>
<td class=”catalog_tdr”>
<table width=”100%” cellpadding=”0″ cellspacing=”0″>
{php $child = get_maincat(0, $mid, $kkk+1);}
{loop $child $i $c}
{if $i%2==0}<tr>{/if}
<td valign=”top” width=”50%” class=”catalog_tds”>
<p>
 <a href=”{$MODULE[$mid][linkurl]}{$c[linkurl]}” target=”_blank” class=”px15″><strong>{set_style($c[catname], $c[style])}</strong></a>
 {if $c[child]}
 {php $sub = get_maincat($c[catid], $mid, 2);}
 {loop $sub $j $s}{if $j < 5} <a href=”{$MODULE[$mid][linkurl]}{$s[linkurl]}” target=”_blank”><strong>{set_style($s[catname], $s[style])}</strong></a>{/if}{/loop}
 {/if}
</p>
{if $c[child]}
{php $sub = get_maincat($c[catid], $mid, 1);}
 <ul>
 {loop $sub $j $s}
 <li><a href=”{$MODULE[$mid][linkurl]}{$s[linkurl]}” target=”_blank” class=”g”>{set_style($s[catname], $s[style])}</a></li>
 {/loop}
 {if $j>8}<li><a href=”{$MODULE[$mid][linkurl]}{$c[linkurl]}” target=”_blank” class=”g”>更多</a></li>{/if}
 </ul>
 <div class=”c_b”></div>
{/if}
</td>
{if $i%2==1}</tr>{/if}
{/loop}
</table>
</td>
</tr>
</table>
</div>
{/loop}
{/if}

样式为:根目录下的skin\default\catalog.css的文件

改为:
.catalog_menu {height:24px;overflow:hidden;background:#FFFBE1 url(‘image/catalog.gif’) no-repeat;border-bottom:#FF821F 1px solid;}

.catalog {border:#FF821F 1px solid;}
.catalog li {float:left;padding:0 10px 0 10px;white-space:nowrap;background:url(‘image/catalog_li.gif’) no-repeat right center;}
.catalog p {font-size:13px;margin:30px 0px 3px 0px; width:18px;}
.catalog strong {color:#004499;}

.catalog td ul{ width:310px; float:left; margin-bottom:10px; display:inline; height:40px; overflow:hidden;}

.catalog_letter {height:32px;overflow:hidden;font-weight:bold;font-size:13px;cursor:pointer;}
.catalog_letter ul {margin:1px 0 0 115px;}
.catalog_letter_li {float:left;padding:3px 7px 6px 6px;color:#FF6600;}
.catalog_letter_on {float:left;padding:3px 7px 6px 6px;color:#FFFFFF;background:#FF6600;}
.catalog_index {width:668px;overflow:hidden;margin:-1px 0 0 0;line-height:24px;font-size:13px;border:#BCBCBC 1px solid;background:#FAFAFA;position:absolute;z-index:100;}
.catalog_index table {margin:10px 0 5px 15px;}
.catalog_index div {height:7px;line-height:7px;font-size:1px;cursor:pointer;background:#DADADA url(‘image/catalog_close.gif’) no-repeat center 2px;}

.catalog_tds {line-height:20px;padding:6px 0px 5px 10px;color:#666666;}
.catalog_tdl {width:26px;padding:10px 0 10px 0;border:#FFEDC1 1px solid;background:#FFFFE0;font-size:14px;font-weight:bold;color:#000000;text-align:center;}
.catalog_tdr {}
.catalog_on_1 {border-bottom:#FFD39A 1px dotted;padding:0 0 5px 0;}
.catalog_on_2 {background:#FCFCE3;border-bottom:#FFD39A 1px dotted;padding:0 0 5px 0;}
.catalog_on_2 .catalog_tdl {border:#FFF2CA 1px solid;background:#FFF2CA;color:#FF7300;}