您现在的位置是:首页 > 教程 > 帝国CMS教程帝国CMS教程
帝国CMS实现调用一周之内信息的功能
翠柔2023-05-31 21:02:31帝国CMS教程已有人查阅
导读调用一周之内的信息,如果本周内某天没有发布信息,调用上周的信息:
调用一周之内的信息,如果本周内某天没有发布信息,调用上周的信息:
最终效果
<?php
//生成一个7天的数组
$datearr=array(1,2,3,4,5,6,0);
$asno=1;
foreach($datearr as $v)
{
echo '<dd id="week'.$asno.'">'.ret_info(ret_date($v)).'</dd>';
//echo '<li>'.date('Y-m-d',ret_date($v)).'</li>';
$asno++;
}
//返回日期的时间戳
function ret_date($val)
{
//今天是星期中的第几天
$this_xingqi=date('w',time());
$no=0;
//如果参数大于几天那么就相减
while($this_xingqi!=$val)
{
$no++;
$this_xingqi=date('w',time()-3600*24*$no);
}
$this_time=time()-3600*24*$no;
return $this_time;
}
//查询当前日期的信息
function ret_info($time)
{
global $empire,$dbtbpre;
//格式化为当前0点
$this_0=strtotime(date('Y-m-d',$time));
//当天 23:59:59
$this_23=strtotime(date('Y-m-d',$time))+3600*23+60*59+59;
$sql=$empire->fetch1("select * from {$dbtbpre}ecms_info where newstime between '{$this_0}' and '{$this_23}'");
if(!$sql)
{
$time=$time-3600*24*7;
ret_info();
}
$str='<ul>';
$str_no=1;
$sql2=$empire->query("select * from {$dbtbpre}ecms_info where newstime between '{$this_0}' and '{$this_23}' order by onclick desc limit 8");
while($r2=$empire->fetch($sql2))
{
//查关联标题
$gl=$empire->fetch1("select * from {$dbtbpre}ecms_list where comicid = '{$r2[comicid]}'");
$lmurl=sys_ReturnBqTitleLink($gl);
$titleurl=sys_ReturnBqTitleLink($r2);
$str.='<li><em class="rank rank-'.$str_no.'">'.$str_no.'</em><a href="'.$lmurl.'" title="'.$gl['title'].'">'.$gl['title'].'</a>[更新<a href="'.$titleurl.'" title="'.$r2['title'].'" class="set">'.$r2['title'].'</a>]
</li>';
$str_no++;
}
$str.='</ul>';
return $str;
}
?>
本文标签:
很赞哦! ()
相关文章
- 帝国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二次开发列表页和内容页只调用年份的方法
帝国cms列表页只调用年份:问题已解决,带入如下,list.var中记得勾选使用程序代码,帝国cms内容页只调用年份: -
帝国cms增加底部访问数统计计数器的方法
如下图所示效果!下载压缩包解压到网站主目录tongji.rar 打开e/public/viewclick/index.php 在if($down==2) { $classf.=',checkpl'; }下面加入if($down==99){$r=$emp -
帝国CMS二次开发PHP循环栏目和栏目下信息的方法
帝国CMS有自带的循环数据标签页可以实现以下效果,但用PHP来实现可以更灵活,可以同时调用各种您需要调用的数据。 -
帝国CMS会员中心模板调用会员中心/控制面版相关页面的方法
会员中心/控制面版相关页面调用会员字段的方法
留言与评论 (共有 条评论) |