View Single Post
  #1   IP: 61.160.30.41
Old 2014-05-01, 10:55 PM
Uintah Uintah is offline
初级会员
 
Join Date: 2012-03-09
Posts: 1
Uintah 现在声名狼藉
Default 当日更新文档日期红色显示

温馨提醒:本教程适用于DedeCMS 通用,V5.3,V5.5,V5.6
Code:

    [field:pubdate runphp='yes']   
    if(date("Y-m-d",@me)==date("Y-m-d")){   
        @me='<font color="#FF0000">'.GetDateTimeMK(@me).'</font>';    
    }else{   
        @me=GetDateTimeMK(@me);   
    }    
    [/field:pubdate]  
如果需要显示其他的格式,比如显示年月日,那么就修改一下 @me=GetDateTimeMK(@me) 和 @me='<font color="#FF0000">'.GetDateTimeMK(@me).'</font>'; 的显示函数,比如@me = MyDate('Y-m-d',@me);

其它的情况大家去摸索一下吧。

P.s:至于24小时内,那就更简单了,直接用 pubdate - time() 做减法后判断情况输出结果。

比如:
Code:

    [field:pubdate runphp='yes']   
    $nowTime = time();   
    if($nowTime - (3600 * 24) < @me){   
        @me='<font color="#FF0000">'.GetDateTimeMK(@me).'</font>';    
    }else{   
        @me=GetDateTimeMK(@me);   
    }    
    [/field:pubdate]  
Reply With Quote