调用一个指定栏目列表:
{pc:content action="lists" catid="6" order="id DESC" num="4"}
{loop $data $key $val}
{$val['title']}
{/loop}
{/pc}
调用同栏目下多个子栏目列表:
{php $subcatid=array();} //这句要视情况要不要加,指的是定义他为数组。
{loop subcat(15) $k $v}
{php $subcatid[] = $k;}
{/loop}
{php $subcatid = implode(',', $subcatid);} //var_dump()显示此时为字符串,如果要再次转化为php数组,可以用 {php $arr=explode(',',$subcatid);}把他再次转化为$arr数组。
{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)}<img src="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/}
$$SH8F5BOR8W96(N@`FVY4.gif">[{date('Y-m-d',$r[inputtime])}]<imgsrc="file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/)A[Y)
I~](ZC9Z[3Y)IDK7LK.gif"> {/loop}
{/pc}
调用任意你想调用的多个子栏目列表:
{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('y-m-d',$r[inputtime])})file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/)A[Y)I~](ZC9Z[3Y)IDK7LK.gif">
{/loop}
{/pc}
注:catid in(21,22,23,24,25):括号内是你想调用的栏目id
"SELECT * from v9_news "中v9_news 是链接的数据库表名,正常不需要更改,如果有更改,换成你自己的数据库表明。