文章采集调用(频道总排行调用方法频道月排行(全站所有文章排行))

优采云 发布时间: 2021-11-26 16:16

  文章采集调用(频道总排行调用方法频道月排行(全站所有文章排行))

  如何调用频道总排名

  

    频道总排行

    {pc:get sql="select a.id,a.title,a.url,a.catid,b.hitsid,b.views from v9_news a left join v9_hits b on a.id=substring(b.hitsid,5) where a.catid in ($arrchildid) order by b.views desc" num="10" cache="3600"}

    

        {loop $data $r}

             {str_cut($r[title],36,'...')}</a>

        {/loop}

    

    {/pc}

  如何调用频道月度排名

  

    频道总排行

    {pc:get sql="select a.id,a.title,a.url,a.catid,b.hitsid,b.views from v9_news a left join v9_hits b on a.id=substring(b.hitsid,5) where a.catid in ($arrchildid) order by b.views desc" num="10" cache="3600"}

    

        {loop $data $r}

             {str_cut($r[title],36,'...')}</a>

        {/loop}

    

    {/pc}

  调用全站所有文章排名方法:

  

{pc:get sql="SELECT a.id,a.url,a.thumb,a.status,b.hitsid,b.views FROM v9_download a, v9_hits b WHERE a.status=99 and a.id=substring(b.hitsid,5) ORDER BY b.views DESC" num="6"}

{loop $data $r}

</a>

{/loop}

{/pc}

  可以看到"substring(b.hitsid,5)"是截取的hitsid字段,从左到右算第5个字符串,即"c-2-5"从左到右算, 1个“C”, 1个“2”, 2个“-”,第5个字符是“5”,截取后只剩下第二个“-”后的id,达到了提取id的最终目的。 ,我还加了一个条件“status=99”,表示文章已经通过,这个是可选的。

0 个评论

要回复文章请先登录注册


官方客服QQ群

微信人工客服

QQ人工客服


线