其实代码很简单的,就是统计今日更新和文章总数的代码,写一下时间判断就可以了。
下面是24小时更新文章,3天更新和10天更新的判断代码。
<div class="lead-title">
<table cellpadding="0" cellspacing="0" border="1" style="width:100%;font-weight:700;text-align:center;" bordercolor="#ff5500">
<tbody>
<td height="28" colspan="5" style="font-size:15px;">
<b>
<script type="text/javascript">(function(){document.write(unescape('%3Cdiv id="bdcs"%3E%3C/div%3E'));var bdcs = document.createElement('script');bdcs.type = 'text/javascript';bdcs.async = true;bdcs.src = 'http://znsv.baidu.com/customer_search/api/js?sid=1152302146349204199' + '&plate_url=' + encodeURIComponent(window.location.href) + '&t=' + Math.ceil(new Date()/3600000);var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(bdcs, s);})();</script>
<div id="bdcs"></div>
<marquee scrollamount="3" behavior="alternate">
<span style="font-size:13px;color:#000000;"> <p><?php
$Log_Model = new Log_Model();
$today = strtotime(date('Y-m-d'));//今天凌晨时间戳
$threeday = strtotime(date('Y-m-d',strtotime('-3 day')));//3天前凌晨时间戳
$tenday = strtotime(date('Y-m-d',strtotime('-10 day')));//10天前凌晨时间戳
$today_sql = "and date>$today";
$today_num = $Log_Model->getLogNum('n', $today_sql);
$threeday_sql = "and date>$threeday";
$threeday_num = $Log_Model->getLogNum('n', $threeday_sql);
$tenday_sql = "and date>$tenday";
$tenday_num = $Log_Model->getLogNum('n', $tenday_sql);
if($tenday_num=='0'){echo '这博客已经废了 都10几天了 没有更新内容 | ';}
elseif($threeday_num=='0'){echo '这博客快要荒废了 连续3天都没有更新文章了 | ';}
elseif($today_num=='0'){echo '今日站长很懒 一篇文章都没更新 | ';}
else{echo ' <b>今日已更新<b style="color:red">'.$today_num.'</b>个资源 | </b> ';}
?><b>本站共分享了<b style="color:re
d"><?php echo $sta_cache['lognum'];?></b>个资源</b></p></span></marquee></b>
</td> </tr>
</tbody>
</table>
</div>
添加位置:
一般添加在模板的log_list.php文件里面,位置自己决定就好
评论