利用dedecms给近三天(或当天)发布的文章显示红色日期或加上new字或new小图片

时间:2022-02-14 10:59:44

1)红色日期

<br>[field:pubdate runphp='yes'] <br>$a="&lt;font color=red&gt;".strftime('%m-%d',@me)."&lt;/font&gt;";

<br>$b=strftime('%m-%d',@me); <br>$ntime = time(); <br>$day3 = 3600 * 24 * 3;

<br>if(($ntime - @me) &lt; $day3) @me = $a; <br>else @me =$b; <br>[/field:pubdate] <br>

2)红色的new

<br>[field:pubdate runphp='yes'] <br>$aa=strftime('%m-%d',@me); <br>

$ntime = time(); <br>$tagtime = @me; <br>$day3 = 3600 * 24 * 3; <br>

if($tagtime &gt; $ntime-$day3) @me = "&lt;font color='red'&gt;(new)&lt;/font&gt;"; <br>

else @me = $aa; <br>[/field:pubdate] <br>

3)加new.jif小图片

<br>[field:pubdate runphp='yes'] <br>$aa=strftime('%m-%d',@me); <br>

$ntime = time(); <br>$tagtime = @me; <br>$day3 = 3600 * 24 * 3; <br>if($tagtime &gt; $ntime-$day3) @me = "&lt;img src='new.gif' /&gt;".$aa; <br>

else @me = $aa; <br>[/field:pubdate] <br>