帝国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=newmysqlquery();
//参数设置
$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="andtypeid=$tid";
}
$query("selecttitlefromphome_ecms_articlewherenewstime>$starttimeandnewstime<$endtime$where");
$sql=$empire->query($query);
$sql=$empire->execute();
$list=array();
while($row=$db->getarray())
{
$row['pubdate']=date('H点i分',$row['pubdate']);
$list[]=$row;
}
functionrili($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="<tablebgcolor=\"#F0F9EE\">";
$str.="<captionvalign=\"center\"><ahref=\"$file?date=$preyear-$premonth-$preday\"><<</a><b>$selectedyear$monthName</b>";
if($nomax&&mktime(0,0,0,$nextmonth,1,$nextyear)>$curtime){
$str.=">></caption>";
}else{
$str.="<ahref=\"$file?date=$nextyear-$nextmonth-$nextday\">>></a></caption>";
}
$str.="<tr>";
for($i=0;$i<7;$i++){
$str.="<tdwidth=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.="<tdclass=calendarTodayalign=center><fontcolor=#ffffff>$day</font></td>";
}else{
if($nomax&&mktime(0,0,0,$selectedmonth,$day,$selectedyear)>$curtime){
$str.="<td>$day</td>";
}else{
$str.="<td><ahref=\"$file?date=$selectedyear-$selectedmonth-$day\">$day</a></td>";
}
}

}
$str.="</tr></table>";
return$str;
}
?>
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title</title>
<metahttp-equiv=Content-Typecontent="text/html;charset=gb2312">
<STYLEtype=text/css>BODY{
PADDING-RIGHT:0px;PADDING-LEFT:0px;FONT-SIZE:14px;PADDING-BOTTOM:0px;MARGIN:5px10px;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
}
.calendarTodayA:link{
COLOR:#fff
}
.calendarTodayA:visited{
COLOR:#fff
}
.calendarTodayA: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:#0091pxsolid
}
#menuA{
TEXT-DECORATION:none
}
#serverA{
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:#0091pxsolid;LINE-HEIGHT:22px;PADDING-TOP:0px
}
#indexrSPAN{
FONT-SIZE:12px;COLOR:#333
}
#indexrA:link{
TEXT-DECORATION:none
}
#indexrA:visited{
TEXT-DECORATION:none
}
#indexrA:hover{
TEXT-DECORATION:underline
}
#indexr.top{
PADDING-LEFT:20px;FONT-WEIGHT:bold;BACKGROUND:#F0F9EE;COLOR:#333;LINE-HEIGHT:26px;BORDER-BOTTOM:#ccc1pxsolid
}
#indexr.bot{
PADDING-RIGHT:10px;PADDING-LEFT:10px;PADDING-BOTTOM:10px;PADDING-TOP:10px;HEIGHT:100%;LINE-HEIGHT:3px
}
#server{
BORDER-TOP:#0091pxsolid;FONT-SIZE:12px;BACKGROUND:#efefef;LINE-HEIGHT:26px;TEXT-ALIGN:center
}
#copy{
FONT-SIZE:12px;LINE-HEIGHT:26px;TEXT-ALIGN:center
}
</STYLE>
</HEAD>
<BODY>
<pid=indexl>
<?php
echo$rili;//这儿输入的是日历,放到你想要的方位
?>
</p>
<pid=indexr>
<pclass=top>
Name</p>
<pclass=bot>
<?=$r=$empire->fetch1($query);
?>
</p></p>
<pclass=clear></p>
</p>
</p>
</body>
</html>

将榜首部分

$query("selecttitlefromphome_ecms_articlewherenewstime>$starttimeandnewstime<$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("selecttitlefromphome_ecms_articlewherenewstimelike'%".date("Y-m-d")."%'limit1");

第二个

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

换成

<?=$r[title]?>


声明:有的资源均来自网络转载,版权归原作者所有,如有侵犯到您的权益 请联系邮箱:123456@qq.com 我们将配合处理!

原文地址:帝国CMS按照日期调用当日更新信息教程发布于2022-07-04 07:43:58

相关推荐