您现在的位置是:首页 > 教程 > 帝国CMS教程帝国CMS教程
帝国CMS按小时和按天等发布文章数量的统计方法
绮纹2023-04-20 23:09:11帝国CMS教程已有人查阅
导读按照小时显示更新数量,统计昨天发表的文章数量,当前栏目本周更新:注释:按栏目统计一周发布文章数 加 classid='栏目id'
按照小时显示更新数量
用sql调用
按当前栏目一周发布文章数 加 classid='$GLOBALS[navclassid]'
用sql调用
6小时:<?=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_表 where newstime>UNIX_TIMESTAMP()-6*3600")?>
12小时:<?=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_表 where newstime>UNIX_TIMESTAMP()-12*3600")?>
24小时:<?=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_表 where newstime>UNIX_TIMESTAMP()-24*3600")?>
一个星期:<?=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_表 where newstime>UNIX_TIMESTAMP()-86400*7")?>
一个月:<?=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_表 where newstime>UNIX_TIMESTAMP()-86400*30")?>
灵动标签调用
6小时:[e:loop={'select count(*) as total from [!db.pre!]ecms_表 where newstime>UNIX_TIMESTAMP()-6*3600',0,24,0}]<?=$bqr[total]?>[/e:loop]
12小时:[e:loop={'select count(*) as total from [!db.pre!]ecms_表 where newstime>UNIX_TIMESTAMP()-12*3600',0,24,0}]<?=$bqr[total]?>[/e:loop]
24小时:[e:loop={'select count(*) as total from [!db.pre!]ecms_表 where newstime>UNIX_TIMESTAMP()-24*3600',0,24,0}]<?=$bqr[total]?>[/e:loop]
一个星期:[e:loop={'select count(*) as total from [!db.pre!]ecms_表 where newstime>UNIX_TIMESTAMP()-86400*7',0,24,0}]<?=$bqr[total]?>[/e:loop]
一个月:[e:loop={'select count(*) as total from [!db.pre!]ecms_表 where newstime>UNIX_TIMESTAMP()-86400*30',0,24,0}]<?=$bqr[total]?>[/e:loop]
12*3600即12小时
86400*7即7天
统计昨天发表的文章数量
<?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 count(*) as total from [!db.pre!]ecms_news where newstime BETWEEN $beginYesterday and $endYesterday",1,24,0}]<?=$bqr[total]?>[/e:loop] 篇 </li>
当前栏目本周更新:
<?=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_news where classid='$GLOBALS[navclassid]' and newstime >UNIX_TIMESTAMP()-86400*7")?>
注释:按栏目统计一周发布文章数 加 classid='栏目id'按当前栏目一周发布文章数 加 classid='$GLOBALS[navclassid]'
//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'))
本文标签:
很赞哦! ()
相关文章
- 帝国cms自定义字段ReturnClassAddField标签截取字数的方法
- 自定义函数解决帝国cms简介截取字符出现html代码的方法
- 本地环境phpStudy搭建帝国CMS的方法
- 帝国cms提示Table 'px.***_enewspubtemp_2' doesn't exist的解决方法
- 帝国cms通过栏目ID获取栏目名称,别名,链接的方法
- 帝国CMS二次开发新浪iplookup根据ip跳转到不同域名的方法
- 帝国CMS怎么实现内容关键字替换图片alt的办法
- 帝国CMS怎么使用egetip()获取用户IP函数
- 帝国cms二次开发实现纯JS版的地区联动筛选功能
- 帝国CMS批量提取第一张图片为标题缩略图的方法
- 帝国cms自带ckeditor编辑器代码高亮的方法codesnippet风格
- 帝国CMS文章和TAG删除编号ID从1开始的方法
随机图文
-
帝国CMS强制下载txt文件浏览器带下载进度显示的方法
一般来说,下载txt会直接打开,把下面的代码放入到下载页面中,就提示下载并可以进度保存了!文件位置(eDownSysclassDownSysFun.php) -
帝国CMS下载包含扣点提醒充点引导会员升级引导等
此下载逻辑为了弥补原始下载逻辑功能比较弱的问题。使用本逻辑在使用帝国CMS下载时,点击下载链接,本逻辑会根据下载地址设置的权限或者点数 -
帝国CMS怎么避免索引重复调用
一、解决父级栏目列表页调用列表信息时,不调用采用索引链接同时发布的文章的方法:二、解决内容页调用相关链接时,显示重复的文章的方法: -
帝国CMS实现单条信息指定不同内容模板调用的方法
帝国CMS的信息是绑定内容模板的,通过本教程可以实现,在前台自由使用不同的模板,比如在网站首页,两处添加同一条信息链接,但不同的同容模板。
留言与评论 (共有 条评论) |