帝国CMS按照日期调用当日更新信息教程
<?php require("../class/connect.php"); include("../class/config.php"); include("../class/q_functions.php"); include("../class/db_sql.php"); include("../class/class.php"); $link=db_connect(); $empire=new mysqlquery(); //参数设置 $rili = rili($date,'',true); $curtime = time(); //赢得时间撕 if(empty($date)){ $timestamp = $curtime; }else{ $timestamp = strtotime($date); } $selectedyear = date('Y',$timestamp); $selectedmonth = date('n',$timestamp); $selectedday = date('d',$timestamp); $starttime = mktime(0,0,0,$selectedmonth,$selectedday,$selectedyear); $endtime = $starttime+86400; $where = ''; $tid = intval($tid); if($tid > 0){ $where = " and typeid=$tid"; } $query ("select title from phome_ecms_article where newstime >$starttime and newstime <$endtime $where"); $sql=$empire->query($query); $sql=$empire->execute(); $list = array(); while($row = $db->getarray()) { $row['pubdate'] = date('H点i分后',$row['pubdate']); $list[] = $row; } function rili($date, $file = '', $nomax = false) { $curtime = time(); //赢得时间撕 if(empty($date)){ $timestamp = $curtime; }else{ $timestamp = strtotime($date); } $selectedyear = date('Y',$timestamp); $selectedmonth = date('n',$timestamp); $selectedday = date('d',$timestamp); //给定月份第一天星期几 $firstday = date('w',mktime(0,0,0,$selectedmonth,1,$selectedyear)); ////给定月份所理应的天数 $lastday = date('t',$timestamp);//取值月份所理应的天数 $preyear = date('Y',mktime(0,0,0,$selectedmonth,0,$selectedyear)); $nextyear = date('Y',mktime(0,0,0,$selectedmonth,$lastday+1,$selectedyear)); $premonth = date('n',mktime(0,0,0,$selectedmonth,0,$selectedyear)); $nextmonth = date('n',mktime(0,0,0,$selectedmonth,$lastday+1,$selectedyear)); $premonthdays = date('t',mktime(0,0,0,$selectedmonth,0,$selectedyear)); $nextmonthdays = date('t',mktime(0,0,0,$selectedmonth,$lastday+1,$selectedyear)); $preday = min($selectedday,$premonthdays); $nextday = min($selectedday,$nextmonthdays); //显示日历头 $days = array("日","一","二","三","四","五","六"); $months = array("一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"); $monthName = $months[$selectedmonth-1]; $str = "
$days[$i] | "; } $str .= ""; $i++; } $day = 0; while($day < $lastday){ if(($i % 7) == 0){ $str .= " | |
$day | "; }else { if($nomax && mktime(0,0,0,$selectedmonth,$day,$selectedyear) > $curtime){ $str .= "$day | "; }else{ $str .= "$day | "; } } } $str .= "
<?php
echo $rili;//这里输入的是日历,放在你想的位置
?>
Name
<?=$r=$empire->fetch1($query);
?>