重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

PHPCMSV9按浏览次数排行调用文章

频道总排行调用方法

成都创新互联主营容城网站建设的网络公司,主营网站建设方案,app开发定制,容城h5小程序定制开发搭建,容城网站营销推广欢迎容城等地区企业咨询


    频道总排行
    {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,'...')}
  •         {/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,'...')}
  •         {/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}
    
  • {/loop} {/pc}

    可以看到“substring(b.hitsid,5)”是截取hitsid字段,从左往右数第5个字符串,即“c-2-5”从左往右数,1个“c”,1个“2”,2个“-”,第5个字符就是“5”,截取后只剩下了第2个“-”后的id,到达了最终提取id的目的。当然,其中我还加入了另一个条件“status=99”,这个表示已经审核通过的文章,这个可有可无。


    网站标题:PHPCMSV9按浏览次数排行调用文章
    URL标题:http://cqcxhl.com/article/pohoce.html

    其他资讯

    在线咨询
    服务热线
    服务热线:028-86922220
    TOP