Dedecms published articles show red date or add new word or new small picture, give nearly three days (or the day) published articles show red date or add new word or new small picture, etc., are around pubdate, write extension.
1, Red Date
- [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) < $day 3) @me = $a;
- else @me = $b;
- [/field:pubdate]
2. Red (new)
- [Field:pubdate runphp=' yes ']
- $aa=strftime ('%m-%d ', @me);
- $ntime = time ();
- $tagtime = @me;
- $day3 = 3600 * 24 * 3;
- if ($tagtime > $ntime-$day 3) @me = "<font color= ' Red ' > (new) </font>";
- else @me = $aa;
- [/field:pubdate]
3, add new.gif small picture
- [Field:pubdate runphp=' yes ']
- $aa=strftime ('%m-%d ', @me);
- $ntime = time ();
- $tagtime = @me;
- $day3 = 3600 * 24 * 3;
- if ($tagtime > $ntime-$day 3) @me = "
- else @me = $aa;
- [/field:pubdate]
The problem to note is: " Can not be used in double quotes, otherwise not.
If you want to highlight the day, change the 3600 * 24 * 3 to 3600 * 24.
Rain field Seoer refer to the above "Dedecms highlight: The latest article shows red date or add new word or new small picture", but is displayed in the latest article, and the students asked to appear in front of the article, so made the appropriate changes, pro-Test effect:
Implemented the latest published article in front of the news icon background effect.
This tutorial is included in the VIP Membership tutorial because it is used more in the actual situation. Dedecms highlighting: The latest articles show red dates or add new or new small images.
DEDECMS latest article show red date or add new word or new small picture