完美解决V9同时调用多个栏目的文章标签

2016-07-01   点击:   发布者:南京互诺科技
在网上搜索多栏目调用文章,都 不太好。V9版本默认好像没有多栏目调用的标签,例如我用{pc:content action="lists" catid ="8,9,10" num="10" order="id DESC"}是出不来的。自己研究了一下弄出来了,现在发出来给跟我一样需要的朋友,代码如下:

{pc:get sql="SELECT `n`.`inputtime`,`n`.`url`,`n`.`title`,`c`.`catname` FROM `v9_news` as `n` left join `v9_category` as `c` on `n`.`catid` = `c`.`catid` where `c`.`catid` in (18,19,20,21,27,30,14) order by `n`.`inputtime` desc" num="8" cache="3600"  return="data"}
 
<ul id="demo2">
  {loop $data $key $val}
<li class="news-item"><a href="{$val['url']}" target="_blank"  title="{$val['title']}">{str_cut($val[title],52,'')}</a></li>
{/loop}
</ul>
      {/pc}    

通过关联查询 出 两表中需要的字段 条件是catid 在 18,19,20,21,27,30,14  这些栏目中。

注: catid in (必须是有文章数的ID,顶级父类不可以)
window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"1","bdSize":"16"},"share":{},"image":{"viewList":["qzone","tsina","tqq","renren","weixin"],"viewText":"分享到:","viewSize":"16"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["qzone","tsina","tqq","renren","weixin"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];

相关阅读