When building a website with zhimeng, you often need to add a new small image after the previous two days in the list page. How can this function be implemented, next, I will explain how dedecms adds a HOTNEW image for the article through this article. If you need a HOTNEW image, you can refer to some of the following methods that dedecms adds hot posts and the latest icons to the article, so how can we achieve it? I will share with you the implementation process.
Add "hot" and "new" labels to the latest images and popular images as needed,
1. the "new" method can be found online. The specific application method is as follows:
[field:pubdate runphp='yes']$ntime = time();$day3 = 3600 * 24 * 3;if(($ntime – @me) < $day3) @me = “”;else @me =”";[/field:pubdate]
2. The "hot" method is added. A simple judgment statement is used here:
[field:click runphp='yes']if(@me > 1000 )@me = ””;else @me = “”;[/field:click]
Here, the click rate is set to 1000. When "click" is greater than 1000, add the span tag and use CSS to locate it to the appropriate place.
Method 2:
Red Date:
[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]
Red (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#newnew.gif: [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]
"Hot" add method network:
[field:click runphp='yes']if(@me > 1000 )@me = ””;else @me = “”;[/field:click]
Here, the click rate is set to 1000. When "click" is greater than 1000, add the span tag and use CSS to locate it to the appropriate place.