PhpCms V9调用指定栏目子栏目文章的两种方法
第一种、直接写子栏目id ,用cat in
{pc:get sql="SELECT * from v9_news where status=99 and catid in(21,22,23,24,25) order by id DESC" num="7" return="data"}
{loop $data $r}
{str_cut($r['title'],40)}({date('m-d',$r[inputtime])}){/loop}
{/pc}
第二种,根据父栏目id,如上面的21,22,23,24,25都是 15下面的子栏目,可以这样写:
{loop subcat(15) $k $v}
{php $subcatid[] = $k;}
{/loop}
{php $subcatid = implode(',', $subcatid);}
{pc:get sql="SELECT * from v9_news where status=99 and catid in ($subcatid) order by id DESC" num="7" return="data" }
{loop $data $r}
[{$CATEGORYS[$r[catid]][catname]}]{str_cut($r['title'],40)}[{date('Y-m-d',$r[inputtime])}]{/loop}
{/pc}