卓越飞翔博客卓越飞翔博客

卓越飞翔 - 您值得收藏的技术分享站
技术文章11201本站已运行3223

帝国CMS二次开发调用一周之内的信息

调用一周之内的信息,如果本周内某天没有公布信息,调用上周的信息:

帝国CMS二次开发调用一周之内的信息

最终效果

<?php
//生成一个7天的数组
$datearr=array(1,2,3,4,5,6,0);
$asno=1;
foreach($datearr as $v)
{
echo ''.ret_info(ret_date($v)).'';
//echo '
  • '.date('Y-m-d',ret_date($v)).'
  • '; $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='
      '; $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.='
    • '.$str_no.''.$gl['title'].'[更新'.$r2['title'].']
    • '; $str_no++; } $str.='
    '; return $str; } ?>

    卓越飞翔博客
    上一篇: 帝国CMS二次开发不同会员组显示不同的颜色和图标
    下一篇: 帝国cms使用方法如何在tags列表页获取当前tag的ID
    留言与评论(共有 0 条评论)
       
    验证码:
    隐藏边栏