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

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

WBOY
Release: 2016-06-13 10:58:14
Original
935 people have browsed it

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]


 

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template