帝国cms灵动标根据时间显示信息排行榜
根据时间显示信息排行榜
信息排行榜
显示一周内信息点击排行
方法一:
[e:loop={"select * from {$dbtbpre}ecms_news where FROM_UNIXTIME(newstime)>SUBDATE(NOW(),INTERVAL 7 DAY) order by onclick desc limit 10",0,24,0}]
<a href="" target="_blank">
[/e:loop]
方法二:
[e:loop={"select * from {$dbtbpre}ecms_news where newstime>UNIX_TIMESTAMP()-86400*7 order by onclick desc limit 10",0,24,0}]
<a href="" target="_blank">
[/e:loop]
方法三:
[e:loop={'news',10,18,0,'newstime>UNIX_TIMESTAMP()-86400*7','onclick desc'}]
<a href="" target="_blank">
[/e:loop]
备注:其中86400*7中的7表示天,如果是月就是30 年就是365
昨天:
[e:loop={"select * from [!db.pre!]ecms_news where newstime BETWEEN $beginYesterday and $endYesterday order by onclick desc limit 10",0,24,0}]
标题:<a href="" target="_blank">---点击:
[/e:loop]
今天:
[e:loop={'news',10,18,0,'newstime>UNIX_TIMESTAMP()-86400*1','onclick desc'}]
标题:<a href="" target="_blank">---点击:
[/e:loop]
一周:
[e:loop={'news',10,18,0,'newstime>UNIX_TIMESTAMP()-86400*7','onclick desc'}]
标题:<a href="" target="_blank">---点击:
[/e:loop]
一月:
[e:loop={'news',10,18,0,'newstime>UNIX_TIMESTAMP()-86400*30','onclick desc'}]
标题:<a href="" target="_blank">---点击:
[/e:loop]
三月:
[e:loop={'news',10,18,0,'newstime>UNIX_TIMESTAMP()-86400*90','onclick desc'}]
标题:<a href="" target="_blank">---点击:
[/e:loop]
一年:
[e:loop={'news',10,18,0,'newstime>UNIX_TIMESTAMP()-86400*365','onclick desc'}]
标题:<a href="" target="_blank">---点击:
[/e:loop]
全部:
[e:loop={'news',10,18,0,'','onclick desc'}]
标题:<a href="" target="_blank">---点击:
[/e:loop]
其他方法:
昨天:
[e:loop={"select * from [!db.pre!]ecms_news where newstime BETWEEN $beginYesterday and $endYesterday order by onclick desc limit 10",0,24,0}]
标题:<a href="" target="_blank">---点击:
[/e:loop]
注释:
//php获取今日开始时间戳和结束时间戳
$beginToday=mktime(0,0,0,date('m'),date('d'),date('Y'));
$endToday=mktime(0,0,0,date('m'),date('d')+1,date('Y'))-1;
//php获取昨日起始时间戳和结束时间戳 (即:前一天)
$beginYesterday=mktime(0,0,0,date('m'),date('d')-1,date('Y'));
$endYesterday=mktime(0,0,0,date('m'),date('d'),date('Y'))-1;
//调取这两天(包括今天):(修改昨天)--date('d')-1:这两天 、date('d')-2:这三天、以此类推(注意:$beginYesterday、$endYesterday这两个未改动,还是沿用的昨天的名称)
$beginYesterday=mktime(0,0,0,date('m'),date('d')-1,date('Y'));
$endYesterday=mktime(0,0,0,date('m'),date('d')+1,date('Y'))-1;
//调取前两天(修改昨天)--date('d')-2:前两天 、date('d')-3:前三天、以此类推(注意:$beginYesterday、$endYesterday这两个未改动,还是沿用的昨天的名称)
$beginYesterday=mktime(0,0,0,date('m'),date('d')-2,date('Y'));
$endYesterday=mktime(0,0,0,date('m'),date('d'),date('Y'))-1;
//php获取上周起始时间戳和结束时间戳
$beginLastweek=mktime(0,0,0,date('m'),date('d')-date('w')+1-7,date('Y'));
$endLastweek=mktime(23,59,59,date('m'),date('d')-date('w')+7-7,date('Y'));
//php获取本周起始时间戳和结束时间戳
$beginThisweek=mktime(0,0 ,0,date("m"),date("d")-date("w")+1,date("Y"));
$endThisweek=mktime(23,59,59,date("m"),date("d")-date("w")+7,date("Y"));
//php获取上月起始时间戳和结束时间戳
$beginLastmonth=mktime(0,0,0,date("m")-1,1,date("Y"))
$endLastmonth=mktime(23,59,59,date("m"),0,date("Y"))
//php获取本月起始时间戳和结束时间戳
$beginThismonth=mktime(0,0,0,date('m'),1,date('Y'));
$endThismonth=mktime(23,59,59,date('m'),date('t'),date('Y'))
标签模板:
列表内容模板(list.var) (*)
[!--title--]
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。