DedeCMS织梦

织梦DedeCMS三天内文章显示红色日期或加上new字或小图片

阿里云

给近三天(或当天)发布的文章显示红色日期或加上 new 字或 new 小图片等。都是围绕 pubdate 做文章,写扩展的。第 2、3 要注意的问题是:如:"<img src='new.gif' />中不能用双引号,否则不行。如果要给当天的加,把 3600 * 24 * 3 改为 3600 * 24  即可。
1、==========红色的日期========

  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) < $day3) @me = $a;
  7. else @me =$b;
  8. [/field:pubdate]
也想出现在这里?联系我们
创客主机

2、==========红色的(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-$day3) @me = "<font color='red'>(new)</font>";
  7. else @me = $aa;
  8. [/field:pubdate]

3、==========加 new.gif 小图片========

  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-$day3) @me = "<img src='new.gif' />".$aa;
  7. else @me = $aa;
  8. [/field:pubdate]

织梦 DedeCMS 三天内文章显示红色日期或加上 new 字或小图片

已有 273 人购买
查看演示升级 VIP立刻购买

收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!