{php $CATEGORY = cache_read('category-'.$mid.'.php');}

{php $child = get_maincat(0, $mid, 1);}

#### 消费品

{loop $child $i $c} {if in_array($c[catid], array(766,767,771,772,802,768,769,770))}

{set_style($c[catname], $c[style])} {if $c[child]}{php $sub = get_maincat($c[catid], $CATEGORY, 2);} {loop $sub $j $s}{if $j < 3} {set_style($s[catname], $s[style])} {/if} {/loop} {/if}
  {if $c[child]}{php $sub = get_maincat($c[catid], $CATEGORY, 1);} {loop $sub $k $s}{if $k < 8} {set_style($s[catname], $s[style])} {/if} {/loop} {/if}

{/if} {/loop}

#### 商业服务

{loop $child $i $c} {if in_array($c[catid], array(802,803,805,806,807,808,813,812))}

{set_style($c[catname], $c[style])} {if $c[child]}{php $sub = get_maincat($c[catid], $CATEGORY, 2);} {loop $sub $j $s}{if $j < 3} {set_style($s[catname], $s[style])} {/if} {/loop} {/if}
  {if $c[child]}{php $sub = get_maincat($c[catid], $CATEGORY, 1);} {loop $sub $k $s}{if $k < 6} {set_style($s[catname], $s[style])} {/if} {/loop} {/if}

{/if} {/loop}

#### 工业品

{loop $child $i $c} {if in_array($c[catid], array( 753,754,755,756,757,763,764))}

{set_style($c[catname], $c[style])} {if $c[child]}{php $sub = get_maincat($c[catid], $CATEGORY, 2);} {loop $sub $j $s}{if $j < 3} {set_style($s[catname], $s[style])} {/if} {/loop} {/if}
  {if $c[child]}{php $sub = get_maincat($c[catid], $CATEGORY, 1);} {loop $sub $k $s}{if $k < 8} {set_style($s[catname], $s[style])} {/if} {/loop} {/if}

{/if} {/loop}

#### 其他

{loop $child $i $c} {if in_array($c[catid], array(803,802,813,805 ))}

{set_style($c[catname], $c[style])} {if $c[child]}{php $sub = get_maincat($c[catid], $CATEGORY, 2);} {loop $sub $j $s}{if $j < 3} {set_style($s[catname], $s[style])} {/if} {/loop} {/if}
  {if $c[child]}{php $sub = get_maincat($c[catid], $CATEGORY, 1);} {loop $sub $k $s}{if $k < 8} {set_style($s[catname], $s[style])} {/if} {/loop} {/if}

{/if} {/loop}