花魁直播高品质美女在线视频互动社区 - 花魁直播官方版

 歡迎來到素材無憂網(wǎng),按 + 收藏我們
登錄 注冊 退出 找回密碼

帝國CMS按照日期調用當日更新信息教程

時間: 2020-09-16 10:47 閱讀: 作者:素材無憂網(wǎng)

帝國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();
//參數(shù)設置
$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));
        ////給定月份所應有的天數(shù)
        $lastday = date('t',$timestamp);//給定月份所應有的天數(shù)
       
        $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 = "<table bgcolor=\"#F0F9EE\">";
        $str .= "<caption valign=\"center\"><a href=\"$file?date=$preyear-$premonth-$preday\"><<</a> <b> $selectedyear  $monthName</b> ";
        if($nomax && mktime(0,0,0,$nextmonth,1,$nextyear) > $curtime){
                $str .= ">></caption>";
        }else{
                $str .= "<a href=\"$file?date=$nextyear-$nextmonth-$nextday\">>></a></caption>";
        }
        $str .= "<tr>";
        for($i=0;$i<7;$i++){
        $str .= "<td width=10%>$days[$i]</td>";
        }
        $str .= "</tr>";
        //空出當月第一天的位置
        $i = 0;
        while($i < $firstday){
                $str .= "<td></td>";
                $i++;
        }
        $day = 0;
        while($day < $lastday){
                if(($i % 7) == 0){
                        $str .= "</tr><tr>";
                }
                $day++;
                $i++;
                //當天用紅色表示
                if($day == $selectedday){
                        $str .= "<td class=calendarToday align=center><font color=#ffffff>$day</font></td>";
                }else {
                        if($nomax && mktime(0,0,0,$selectedmonth,$day,$selectedyear) > $curtime){
                                $str .= "<td>$day</td>";
                        }else{
                                $str .= "<td><a href=\"$file?date=$selectedyear-$selectedmonth-$day\">$day</a></td>";
                        }
                }
               
        }
        $str .= "</tr></table>";
        return $str;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title</title>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<STYLE type=text/css>BODY {
        PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 14px; PADDING-BOTTOM: 0px; MARGIN: 5px 10px; PADDING-TOP: 0px
}
#header {
        PADDING-LEFT: 5px
}
IMG {
        BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px
}
.STYLE1 {font-size: small}
.left {
        FLOAT: left
}
.t {
     PADDING-top: 5px
}
.right {
        FLOAT: right
}
.calendarHeader {
        FONT-WEIGHT: bolder; COLOR: #c00; BACKGROUND-COLOR: #ffc
}
.calendarToday {
        COLOR: #fff; BACKGROUND-COLOR: #f00
}
.calendarToday A:link {
        COLOR: #fff
}
.calendarToday A:visited {
        COLOR: #fff
}
.calendarToday A:hover {
        COLOR: #fff
}
.calendar {
        COLOR: #333; BACKGROUND-COLOR: #ffc
}
A.hot:link {
        COLOR: #f00
}
A.hot:visited {
        COLOR: #f00
}
A:link {
        COLOR: #009
}
A:visited {
        COLOR: #009
}
A:hover {
        COLOR: #c00
}
.clear {
        CLEAR: both; FONT-SIZE: 0px; VISIBILITY: hidden; LINE-HEIGHT: 0px; HEIGHT: 0px
}
#menu {
        PADDING-LEFT: 10px; BACKGROUND: #efefef; LINE-HEIGHT: 26px; BORDER-BOTTOM: #009 1px solid
}
#menu A {
        TEXT-DECORATION: none
}
#server A {
        TEXT-DECORATION: none
}
#indexl {
        PADDING-RIGHT: 10px; PADDING-LEFT: 10px; FLOAT: left; PADDING-BOTTOM: 10px; PADDING-TOP: 10px
}
.yester {
        MARGIN-TOP: 6px; LINE-HEIGHT: 22px; TEXT-ALIGN: center
}
#indexr {
        PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FLOAT: left; PADDING-BOTTOM: 0px; BORDER-LEFT: #009 1px solid; LINE-HEIGHT: 22px; PADDING-TOP: 0px
}
#indexr SPAN {
        FONT-SIZE: 12px; COLOR: #333
}
#indexr A:link {
        TEXT-DECORATION: none
}
#indexr A:visited {
        TEXT-DECORATION: none
}
#indexr A:hover {
        TEXT-DECORATION: underline
}
#indexr .top {
        PADDING-LEFT: 20px; FONT-WEIGHT: bold; BACKGROUND: #F0F9EE; COLOR: #333; LINE-HEIGHT: 26px; BORDER-BOTTOM: #ccc 1px solid
}
#indexr .bot {
        PADDING-RIGHT: 10px; PADDING-LEFT: 10px; PADDING-BOTTOM: 10px; PADDING-TOP: 10px; HEIGHT: 100%; LINE-HEIGHT: 3px
}
#server {
        BORDER-TOP: #009 1px solid; FONT-SIZE: 12px; BACKGROUND: #efefef; LINE-HEIGHT: 26px; TEXT-ALIGN: center
}
#copy {
        FONT-SIZE: 12px; LINE-HEIGHT: 26px; TEXT-ALIGN: center
}
</STYLE>
</HEAD>
<BODY>
<p id=indexl>
<?php
echo $rili;//這里輸入的是日歷,放到你想要的位置
?>
</p>
<p id=indexr>
<p class=top>
Name </p>
<p class=bot>
<?=$r=$empire->fetch1($query);
?>
</p></p>
<p class=clear></p>
</p>
</p>
</body>
</html>

將第一部分

$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;
}

換成:

$r=$empire->fetch1("select title from phome_ecms_article where newstime like '%".date("Y-m-d")."%' limit 1");

第二個

<?=$r=$empire->fetch1($query);
?>

換成

<?=$r[title]?>


版權聲明: 本站資源均來自互聯(lián)網(wǎng)或會員發(fā)布,如果侵犯了您的權益請與我們聯(lián)系,我們將在24小時內刪除!謝謝!

轉載請注明: 帝國CMS按照日期調用當日更新信息教程

標簽:  
相關文章
模板推薦