1861资源网:您身边、安全、高速、放心的专业下载站!
手机站 软件专题
1861资源网
热门搜索: 请搜索 软件: 相关信息 照明商店 搜索 教程:相关 爆裂点 照明商店 请输入 相关: 软件

帝国CMS分类信息过期时间设置(发布信息选择多久之后显示过期)

    第一步:增加字段gqtime  类型选择日期。

    投稿表单替换html代码(增加字段时请留空)内容修改为:

    下面这段代码没有完全显示,全部复制就可以啦
    后台可以管理
    
    我终于整明白了
    
    我把代码分享出来
    
    输入表单替换html代码
    <select name="gqtime" id="gqtime">
    <option value="<?echo date("Y-m-d",strtotime("+7day")); ?>"> 7天后过期</option>
    <option value="<?echo date("Y-m-d",strtotime("+1month")); ?>">一个月后过期</option>
    <option value="<?echo date("Y-m-d",strtotime("+3month")); ?>">三个月后过期</option>
    <option value="<?echo date("Y-m-d",strtotime("+6month")); ?>">六个月后过期</option>
    <option value="<?echo date("Y-m-d",strtotime("+20year")); ?>">长期有效</option>
    </select>
    
    投稿表单替换html代码
    <select name="gqtime" id="gqtime">
    <option value="<?echo date("Y-m-d",strtotime("+7day")); ?><?=DoReqValue($tbname,'gqtime',stripSlashes($r[gqtime]))?>">7天后过期</option>
    <option value="<?echo date("Y-m-d",strtotime("+1month")); ?><?=DoReqValue($tbname,'gqtime',stripSlashes($r[gqtime]))?>">一个月后过期</option>
    <option value="<?echo date("Y-m-d",strtotime("+3month")); ?><?=DoReqValue($tbname,'gqtime',stripSlashes($r[gqtime]))?>"selected>三个月后过期</option>
    <option value="<?echo date("Y-m-d",strtotime("+6month")); ?><?=DoReqValue($tbname,'gqtime',stripSlashes($r[gqtime]))?>">六个月后过期</option>
    <option value="<?echo date("Y-m-d",strtotime("+20year")); ?><?=DoReqValue($tbname,'gqtime',stripSlashes($r[gqtime]))?>">长期有效</option>
    </select>
    
    这样就OK了
    

     第二步:打开e/class/connect.php文件,找到  //栏目链接。在其上面一行加入如下代码:

    //时间
            $odate = round(((strtotime($r[gqtime])-strtotime(date('Y-m-d')))/86400),0);
             if ($odate>0)
                     {
                     $diffTime = ''; //
                     }
             else if ($odate==0)
                     {
                     $diffTime = '今天到期 ';
                     }
             else
                      {
                     $diffTime = '<span class="expire">已过期</span> ';
                     }
            $listtemp = str_replace ('[!--diffTime--]', $diffTime, $listtemp);
    

     第三步:信息调用:

    列表页调用:[!--diffTime--]

    内容页引用JS:

    <script language="javascript" src="images/date.js"></script> 

    在需要显示的地方调用:

    <script>check_tdate('[!--gqtime--]')</script>

      date.js 文件代码如下:

    // JavaScript Document
    function check_tdate(odate){ 
    var checkArray= new Array() ;
    //nowArray    = odate.split(" ");
    checkArray    = odate.split("-"); 
    checkDate   = new  Date(checkArray[0],checkArray[1],checkArray[2]);
    
    var nowTime   = new Date();// 现在时间
    var the_year  = nowTime.getYear(); 
    var the_month = nowTime.getMonth() + 1; 
    var the_day   = nowTime.getDate();
    nowTime    = new  Date(the_year,the_month,the_day); 
    
    var thesecond = 24 * 60 * 60 *1000 ; 
    var diffTime  = (nowTime - checkDate)/thesecond;//计算天数
    if (diffTime>0)
    {
    myreturn ="<div style='position:absolute;z-index:100;margin-left:150px;'><img src=../../../images/guoqi.gif></div>";
    }
    else if (diffTime==0)
    {
    myreturn = '';
    }
    else
      {
    diffTime=0-diffTime;
    myreturn = '';
    }
    //alert(myreturn); 
    document.write(''+myreturn+'')
    }
帝国教程 发布: 2022-04-14   修改: 2026-04-17   阅:   评:
相关文章
本类最新发布
本类推荐
本类评论
留言与评论(共有 0 条评论)
验证码:
本类软件分类
文章总排行
文章月排行
装机必备软件
全站下载总排行

1861资源网

http://www.zywlyy.cn/

   |

1861资源网 软件下载

1861资源网

使用手机软件扫描微信二维码

关注我们可获取更多热点资讯

感谢网络科技公司技术支持