帝国CMS按照日期调用当日更新信息教程
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 = "";
$str .= "<< $selectedyear $monthName ";
if($nomax && mktime(0,0,0,$nextmonth,1,$nextyear) > $curtime){
$str .= ">> ";
}else{
$str .= ">>";
}
$str .= "";
for($i=0;$i<7;$i++){
$str .= "$days[$i] ";
}
$str .= " ";
//空出当月第一天的位置
$i = 0;
while($i < $firstday){
$str .= " ";
$i++;
}
$day = 0;
while($day < $lastday){
if(($i % 7) == 0){
$str .= "";
}
$day++;
$i++;
//当天用红色表示
if($day == $selectedday){
$str .= "$day ";
}else {
if($nomax && mktime(0,0,0,$selectedmonth,$day,$selectedyear) > $curtime){
$str .= "$day ";
}else{
$str .= "$day ";
}
}
}
$str .= "
";
return $str;
}
?>
Title
Name
=$r=$empire->fetch1($query);
?>
将第一部分
$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]?>
版权声明: 本站资源均来自互联网或会员发布,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!
转载请注明: 帝国CMS按照日期怎么调用当日更新信息