显示一周内信息点击排行
方法一:
[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="<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a> <br> [/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="<?=$bqsr['titleurl']?>" target="_blank"><?=$bqr['title']?></a> <br> [/e:loop]
[e:loop={'news',10,18,0,'newstime>UNIX_TIMESTAMP()-86400*7','onclick desc'}] <a href="<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></a><br> [/e:loop]
备注:其中86400*7中的7表示天,如果是月就是30 年就是365
昨天:
<?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; ?> [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="<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></a>---点击:<?=$bqr[onclick]?><br> [/e:loop]
今天:
[e:loop={'news',10,18,0,'newstime>UNIX_TIMESTAMP()-86400*1','onclick desc'}] 标题:<a href="<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></a>---点击:<?=$bqr[onclick]?><br> [/e:loop]
一周:
[e:loop={'news',10,18,0,'newstime>UNIX_TIMESTAMP()-86400*7','onclick desc'}] 标题:<a href="<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></a>---点击:<?=$bqr[onclick]?><br> [/e:loop]
一月:
[e:loop={'news',10,18,0,'newstime>UNIX_TIMESTAMP()-86400*30','onclick desc'}] 标题:<a href="<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></a>---点击:<?=$bqr[onclick]?><br> [/e:loop]
三月:
[e:loop={'news',10,18,0,'newstime>UNIX_TIMESTAMP()-86400*90','onclick desc'}] 标题:<a href="<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></a>---点击:<?=$bqr[onclick]?><br> [/e:loop]
一年:
[e:loop={'news',10,18,0,'newstime>UNIX_TIMESTAMP()-86400*365','onclick desc'}] 标题:<a href="<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></a>---点击:<?=$bqr[onclick]?><br> [/e:loop]
全部:
[e:loop={'news',10,18,0,'','onclick desc'}] 标题:<a href="<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></a>---点击:<?=$bqr[onclick]?><br> [/e:loop]
其他方法:
昨天:
<?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; ?> [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="<?=$bqsr[titleurl]?>" target="_blank"><?=$bqr[title]?></a>---点击:<?=$bqr[onclick]?><br> [/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) (*)
<li class="no[!--no.num--]"><a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a></li>
评论排行
order by plnum
当前仅支持登录后发布评论