DEDECMS latest article show red date or add new word or new small picture

Source: Internet
Author: User

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

  1. [Field:pubdate runphp=' yes ']
  2. $a="<font color=red>". Strftime ('%m-%d ', @me). "  </font> ";
  3. $b=strftime ('%m-%d ', @me);
  4. $ntime = time ();
  5. $day3 = 3600 * 24 * 3;
  6. if ($ntime-@me) < $day 3) @me = $a;
  7. else @me = $b;
  8. [/field:pubdate]

2. Red (new)

    1. [Field:pubdate runphp=' yes ']
    2. $aa=strftime ('%m-%d ', @me);
    3. $ntime = time ();
    4. $tagtime = @me;
    5. $day3 = 3600 * 24 * 3;
    6. if ($tagtime > $ntime-$day 3) @me = "<font color= ' Red ' > (new) </font>";
    7. else @me = $aa;
    8. [/field:pubdate]

3, add new.gif small picture

    1. [Field:pubdate runphp=' yes ']
    2. $aa=strftime ('%m-%d ', @me);
    3. $ntime = time ();
    4. $tagtime = @me;
    5. $day3 = 3600 * 24 * 3;
    6. if ($tagtime > $ntime-$day 3) @me = "
    7. else @me = $aa;
    8. [/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

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.