下面是实现首页调用全站的“日、周、月”点击排行的GET调用代码:
{pc:get sql="SELECT h.`weekviews`,n.`title`,n.`url`,n.`style` FROM `v9_hits` AS h,`v9_news` AS n WHERE substring_index(h.`hitsid`, '-', -1)=n.`id` AND n.`status`=99 ORDER BY h.`weekviews` DESC" num="9" cache="3600" day="7"}
{loop $data $v}
{if $n%2==1}<li>{else}<li class="bg">{/if}<a title="{$v[title]}" target="_blank" href="{$v[url]}">{str_cut($v['title'],200,'...')}</a><br /><span>点击:{number_format($v['weekviews'])}</span></li>
{/loop}
{/pc}
此代码是周点击排行:日点击和月点击只要替换红色部分即可!
48小时点击:dayviews、day=2
本月点击:monthviews、day=48
效果: