How does DEDECMS Add a HOTNEW flag to an article? _ javascript skills

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.