phpcms怎么调用阅读量、按点击量/阅读量排序、调用整站排行(不用修改文件)

phpcms怎么调用阅读量、按点击量/阅读量排序、调用整站排行

重点在这

{pc:get sql="SELECT h.`views`,n.`title`,n.`url`,n.`thumb`,n.`inputtime`,n.`description` FROM `v9_hits` AS h,`v9_news` AS n WHERE substring_index(h.`hitsid`, '-', -1)=n.`id` AND n.`status`=99 AND n.`catid`=10 ORDER BY n.`inputtime` DESC" num="12" cache="3600"}

用法:①怎么调用阅读量?

h.`views` 默认调用总阅读量,还可改为 h.`dayviews` / h.`weekviews` / h.`monthviews`  调用天、周、月的阅读量

②调用文章相关信息:

n.`title`,n.`url`,n.`thumb`,n.`inputtime`,n.`description`   调用文章标题、url、缩略图、发布时间、描述

③怎么调用整站文章排行?

n.`catid`=10  ‘10’是栏目id,调用哪个栏目就改成哪个栏目的id,调用整站所有文章则删掉“AND n.`catid`=10 ”这句

④怎么修改排序方式?

n.`inputtime` DESC   n.`inputtime`按发布时间排序可更改为:h.`views`按总阅读量排序、n.`updatetime`按修改时间排序、n.`id`按id排序

DESC为降序,可改为ASC,即按升序排序

实际案例:

{pc:get sql="SELECT h.`views`,n.`title`,n.`url`,n.`thumb`,n.`inputtime`,n.`description` FROM `v9_hits` AS h,`v9_news` AS n WHERE substring_index(h.`hitsid`, '-', -1)=n.`id` AND n.`status`=99 AND n.`catid`=10 ORDER BY n.`inputtime` DESC" num="12" cache="3600"}
{loop $data $v}
  • 缩略图: 标题: {str_cut($v['title'],100)} 描述:

    {$v['description']}

    发布时间: {date('Y-m-d',$v[inputtime])} 点击量: {$v['views']}
  • {/loop} {/pc}

    phpcms交流或网站开发、模版制作联系 185 6521 8425

    你可能感兴趣的:(PHPCMS)