PCMS V9多栏目多推荐位调用数据列表方法

一、同时调用多个栏目的文章,文章前显示栏目名称:


{pc:get sql="select * from v9_news where catid in (61,62,63,64,65) order by id desc" num="10"return="data" }

{loop $data $n $r}

[{$categorys[$r['catid']]['catname']}]{str_cut($r[title],27,'')}

{/loop} 

{/pc}


复制代码


二、不同栏目不同推荐位的数据同时调用:


调用需求:文章范围为59 60 61三个栏目,并且推送到了27 和28两个推荐位;从第三条开始,连续调用7篇文章。


{pc:get sql="select * from v9_news where id in (select id from v9_position_data where posid in(27,28) and catid in(59,60,61)) order by listorder desc" cache="3600"start="3" num="7"return="data" }

{loop $data $n $r}

・{str_cut($r[title],22,'')}

{/loop} 

{/pc}


复制代码

特别说明:

其中

select * from v9_news

from v9_position_data

你可能感兴趣的:(phpcmsv9,多栏目)