Ecmsphp开发中心

1252

帖子

19

跟帖

8

粉丝

用户组:普通会员

头    衔:白银会员

版主

积分
356930
登陆
2134 次
私信
注册时间
2014-06-21 14:06:06
最后登陆时间
2023-09-24 16:04:46

帝国CMS调用一周之内的信息文章

 [只看主题]
楼主
0 |
发表: 3 年前
| |
| |
跳转

  帝国CMS调用一周之内的信息文章

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

帝国CMS调用一周之内的信息文章 帝国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;
}
?>


ecmsphp开发中心
ecmsphp开发中心
验证码 换一个

当前在线人数: 0
取消

感谢您的支持,我们会继续努力!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

×

打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮

帝国CMS调用一周之内的信息文章