网站首页  汉语字词  英语词汇  考试资料  写作素材  旧版资料

请输入您要查询的考试资料:

 

标题 织梦DEDECMS中让近三天发布的文章显示红色日期或加上new字或小图片的方法
内容
    为了在网站上显示更新的内容引起访问人的注意,可以让把最近三天的文章显示为红色.下面来看一下代码
    给近三天(或当天)发布的文章显示红色日期或加上new字或new小图片等。
    都是围绕pubdate做文章,写扩展的。
    第2、3要注意的问题是:如:"<img src='new.gif' />中不能用双引号,否则不行。
    如果要给当天的加,把 3600 * 24 * 3 改为 3600 * 24  即可。
    1、==========红色的日期========
    代码如下:
    [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]
    2、==========红色的(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]
    3、==========加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]
随便看

 

在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。

 

Copyright © 2002-2024 cuapp.net All Rights Reserved
更新时间:2025/5/12 22:08:45