教程:如何按照日期调用帝国CMS当日更新信息
帝国CMS按照日期调用当日更新信息的教程如下:首先,登录帝国CMS后台管理系统。然后,在“系统”菜单下选择“数据备份/恢复”。接着,点击“备份数据”,选择需要备份的数据库表和字段。接下来,在“备份选项”中勾选“只备份当日数据”,并设置好其他参数。最后,点击“开始备份”按钮,等待备份完成即可。这样,您就可以按照日期调用当日更新信息了。如果您需要恢复数据,可以在“数据备份/恢复”页面中选择“恢复数据”,然后按照提示操作即可。
帝国CMS按照日期调用当日更新信息教程
<?phprequire("../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><divid=indexl><?phpecho$rili;//这里输入的是日历,放到你想要的位置?></div><divid=indexr><divclass=top>Name</div><divclass=bot><?=$r=$empire->fetch1($query);?></div></div><divclass=clear></div></div></div></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]?>