一、同时调用多个栏目的文章,文章前显示栏目名称:
{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
本文转自 gutaotao1989 51CTO博客,原文链接:http://blog.51cto.com/taoyouth/1562169