Home > Web Front-end > JS Tutorial > body text

How does DEDECMS add the HOT NEW logo image to the article_javascript skills

WBOY
Release: 2016-05-16 15:45:09
Original
1263 people have browsed it

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]
Copy after login

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]
Copy after login

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]
Copy after login

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]
Copy after login

“hot” adding method website:

[field:click runphp='yes']

if(@me > 1000 )@me = ”<span class='hot_ico'></span>”;

else @me = “”;

[/field:click]
Copy after login

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.

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!