当天发布的信息显示为[今天] 昨天发布的信息显示为[昨天] 昨天以前发的就显示为日期 没学过php,所以代码可能有点乱!但是可以用!
如果哪里乱望高手指出!
[e:loop={"select * from phome_ecms_info where classid=9 and checked=1 order by newstime desc limit 24",24,24,0}] <? $today=date(time()); $today_y=date('Y',time()); $today_m=date('n',time()); $today_d=date('j',time()); $newstime1y=date('Y',$bqr[newstime]); $newstime1m=date('n',$bqr[newstime]); $newstime1d=date('j',$bqr[newstime]); $newday=$newstime1d+1; if($today_y==$newstime1y&&$today_m==$newstime1m){ if($today_d==$newstime1d){ $newstime2="[<font color=red>今天</font>]";} elseif($today_d==$newday) {$newstime2="[<font color=red>昨天</font>]"; } else {$newstime2=date('m-d',$bqr[newstime]); $newstime2="[$newstime2]"; }
} ?>
<li><span class="address_Q">[<?=$bqr[myarea]?>] <a href="<?=$bqsr[titleurl]?>" title="<?=$bqr[title]?>" target="_blank"><?=$bqr[title]?></a> <?=$newstime2?></span></li> [/e:loop]
上传以下图片:
|