Someone in the group needs dedecms to add hot posts and the latest icons to articles. So how to implement it? Script House will share with you the implementation process.
According to the needs of the website, small "hot" and "new" signs should be added to the latest published pictures and popular pictures,
1. The method of adding “new” can be found online. The specific application method is:
[field:pubdate runphp='yes']$ntime = time();$day3 = 3600 * 24 * 3;if(($ntime – @me) < $day3) @me = “<span class='new_ico'></span>”;else @me =”";[/field:pubdate]
2. "hot" adding method, here a simple judgment statement is used to implement it:
[field:click runphp='yes']if(@me > 1000 )@me = ”<span class='hot_ico'></span>”;else @me = “”;[/field:click]
The click-through rate here is set to 1000. When "click" is greater than 1000, add a span tag and then use CSS to position it in the appropriate place.
Method 2:
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) < $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 = "<font color='red'>(new)</font>"; else @me = $aa; [/field:pubdate] 加new.gif小图片: [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]
“hot” adding method website:
[field:click runphp='yes'] if(@me > 1000 )@me = ”<span class='hot_ico'></span>”; else @me = “”; [/field:click]
The click-through rate here is set to 1000. When "click" is greater than 1000, add a span tag and then use CSS to position it in the appropriate place.