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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 10:58:14958browse

1)红色日期

 
[field:pubdate runphp='yes']
$a="".strftime('%m-%d',@me)."";


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


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

2)红色的new


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

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

if($tagtime > $ntime-$day3) @me = "(new)";

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


3)加new.jif小图片

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

$ntime = time();
$tagtime = @me;
$day3 = 3600 * 24 * 3;
if($tagtime > $ntime-$day3) @me = "".$aa;

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


 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn