好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 網站建設 > 建站知識 > 【原創】DedeCms最新文章顯示紅色日期或加上new字

【原創】DedeCms最新文章顯示紅色日期或加上new字

POST TIME:2020-04-10 21:06

DedeCMS發布的文章顯示紅色日期或加上new字或new小圖片,給近三天(或當天)發布的文章顯示紅色日期或加上new字或new小圖片等,都是圍繞pubdate做文章,寫擴展的。

1、紅色的日期


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

3、加new.gif小圖片


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

要注意的問題是:如:"<img src='new.gif' />中不能用雙引號,否則不行。

如果要給當天的高亮顯示,把 3600 * 24 * 3 改為 3600 * 24  即可。

站長地帶參考了上面的《DedeCms高亮顯示:最新文章顯示紅色日期或加上new字或new小圖片》,但是都是顯示在最新文章后面的,而學員要求顯示在文章的前面,于是做了適當的修改,親測效果:

實現了最新發布文章在前面在NEWS圖標背景效果。

此教程,以納入VIP會員教程中,因為在實際情況用到的比較多。DedeCms高亮顯示:最新文章顯示紅色日期或加上new字或new小圖片。



收縮
  • 微信客服
  • 微信二維碼
  • 電話咨詢

  • 400-1100-266