Home > Backend Development > PHP Tutorial > Use dedecms to display red dates or add new words or new small pictures to articles published in the past three days (or the same day)_PHP tutorial

Use dedecms to display red dates or add new words or new small pictures to articles published in the past three days (or the same day)_PHP tutorial

WBOY
Release: 2016-07-14 10:12:15
Original
1087 people have browsed it

1)红色日期

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


$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 = "<font color='red'>(new)</font>";

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 = "<img src='new.gif' />".$aa;

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


 

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/477231.htmlTechArticle1)红色日期 br[field:pubdate runphp=yes] br$a=lt;font color=redgt;.strftime(%m-%d,@me).lt;/fontgt;; br$b=strftime(%m-%d,@me); br$ntime = time(); br$day3 = 3600 * 24 * 3; brif(($...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template