看一下效果图:
此主题相关图片如下:newgif.jpg
1\首先在模板中加入以下JS代码
<script>
function NewGif(ss,days)
{
var Adddate=new Date(ss);
var today=new Date();
msPerDay=24*60*60*1000;
daysleft=(today.getTime()-Adddate.getTime())/msPerDay;
daysleft=Math.round(daysleft);
if(daysleft<days)
document.write("<img src='/pic/other/new01.gif' border=0 height=12>");
}
</script>
其中ss是表示文章发表的日期格式"YYYY/MM/DD",days是表示文章发表日期与现在时间相差天数,小于days会显示图标,
相应的图标是最后一行修改.
2\建立一个SQL标签,因为是自定义的方便,如我的
SQL:select top {$Param(1)} ID,Tid,Title,Author,ArticleInput,Origin,Adddate,Hits,Intro,Recommend from KS_Article where tid in (select id from ks_class where tn='{$Param(0)}') and verific=1 order by adddate desc
循环体:
[loop={$Param(1)}]
<tr>
<td height="20">·<a href="/Article/ShowInfo.asp?ID={$Field(ID,GetInfoUrl,1,2)}" title="标题:{$Field(Title,Text,0,...,0,)}<br/>录入员:{$Field(ArticleInput,Text,0,...,0,)}<br/>点击数:{$Field(Hits,Num,0,2)}">{$Field(Title,Text,38,0,0,)}</a><script language="JavaScript">NewGif("{$Field(Adddate,Date,YYYY/MM/DD)}",10);</script></td><td width="70" nowrap align=right><span>{$Field(Adddate,Date,YYYY-MM-DD)}</span></td>
</tr>
[/loop]
注意红的字:调用它,日期字段的格式要对.
3\模板中调用SQL_栏目标签,其它的不说.