
实现代码如下:
{loop subcat($catid) $c}
{if $c['child']}
{php $child = subcat($c['catid']);}
<div class="wj_fenlei">
<div class="fenlei_pic">
<em><img src="{php echo $c['p_w_picpath'];}" width="298" height="144" alt="" /></em>
<div class="xmtit">{php echo $c['catname'];}+</div>
<div class="xian">
<span>{php echo "<a href='".$c['url']."' target='_blank'>".$c['catname']."</a>";}</span>
<div class="xm_a">
{loop $child $catc}
{php $subcatid[] = $catc['catid'];}
{php echo "<a href='".$catc['url']."' target='_blank'>".$catc['catname']."</a>";}
{/loop}
</div>
</div>
</div>
<ul>
{php $subcatid = implode(',', $subcatid);}
{php $arr=explode(',',$subcatid);}
{pc:get sql="SELECT * from v9_news where status=99 and catid in ($subcatid) order by id DESC LIMIT 0,4--" num="6" return="data"}
{loop $data $r}
<li> <a href="{$r[url]}" target="_blank" title="{$r['title']}">● [{$CATEGORYS[$r[catid]][catname]}] {str_cut($r['title'],40)}</a></li>
{/loop}
{/pc}
</ul>
<div class="zs_more">
{php echo "<a href='".$c['url']."' target='_blank'>我想了解更多".$c['catname']."知识</a>";}
</div>
</div>
{php $subcatid = null;}
{/if}
{/loop}