实现代码如下:

{loopsubcat($catid)$c}{if$c['child']}{php$child=subcat($c['catid']);}<divclass="wj_fenlei"><divclass="fenlei_pic"><em><imgsrc="{phpecho$c['p_w_picpath'];}"width="298"height="144"alt=""/></em><divclass="xmtit">{phpecho$c['catname'];}+</div><divclass="xian"><span>{phpecho"<ahref='".$c['url']."'target='_blank'>".$c['catname']."</a>";}</span><divclass="xm_a">{loop$child$catc}{php$subcatid[]=$catc['catid'];}{phpecho"<ahref='".$catc['url']."'target='_blank'>".$catc['catname']."</a>";}{/loop}</div></div></div><ul>{php$subcatid=implode(',',$subcatid);}{php$arr=explode(',',$subcatid);}{pc:getsql="SELECT*fromv9_newswherestatus=99andcatidin($subcatid)orderbyidDESCLIMIT0,4--"num="6"return="data"}{loop$data$r}<li><ahref="{$r[url]}"target="_blank"title="{$r['title']}">●[{$CATEGORYS[$r[catid]][catname]}]{str_cut($r['title'],40)}</a></li>{/loop}{/pc}</ul><divclass="zs_more">{phpecho"<ahref='".$c['url']."'target='_blank'>我想了解更多".$c['catname']."知识</a>";}</div></div>{php$subcatid=null;}{/if}{/loop}