Support jOOmla! Autoit!
最新文章模块条目后面增加new或图片 输出PDF 打印 E-mail
Author Author: Autoit | Date Date:2006-12-27 | View Count View: 13806 | Digg Count Digg: 67

本文以 " 最新文章模块增加发布时间的hack " 为基础hack的. 来实现 "一周内最新文章"的标题后面增加一个 New! 的文字或图片.

主要是依据时间戳的差值来判断的. 方法: 在上篇文章里增加的

<small><?php echo $row->created; ?></small>

后面增加:

<?php if ((abs(strtotime ($now) - strtotime ($row->created))/86400) < 7) 
echo " <sup style='color:#FF0000; cursor:hand;' title='一周内最新文章'>New!</sup>";
 ?>

就可以了.

如果需要24小时,把上面的7换为1就可以了. 如果和上面一样有中文字出现,那么你修改的这个文档就要保存为 utf-8 格式. 

如果需要把 New! 文字换为你的一个小new的图片. 就改上面 echo 里面的了.大概这个样子, 当然,如果不想显示日期的话,<small>...</small> 句就可以不要了.

echo "<img src='.....'>";

End. by Autoit.


Permanent URL: http://www.autoit.cn/index.php/content/view/94/25.html

Shares: Google书签 Yahoo书签 雅虎收藏夹 365Key网摘 新浪ViVi 百度收藏 天极网摘 diglog 和讯网摘 POCO网摘 YouNote网摘 博拉网 天下图摘 spurl blogmarks BlinkList reddit digg Del.icio.us   |  Tags: 最新文章  latestnews  时间  hack  

 
在最新文章模块标题右侧加 more 的推荐方法!   自定义任意分类里文章上横幅图片的显示