详情页

帝国cms最新文章显示红色日期的教程

时间:2024年02月22日

编辑:佚名

首先,要在模板中选中“使用程序代码”。
然后,在列表内容模板(list.var)框中,添加如下代码: 
复制代码
$newimg='[!--newstime--]';
if(time()-$r[newstime]<=1*24*3600)
{
        $newimg='<FONT color=red>[!--newstime--]</FONT>';
}  
$listtemp='<li><span class="date">'.$newimg.'</span> <a href="[!--titleurl--]" target=_blank>[!--title--]</a> </li>';
或者使用灵动标签
复制代码
<ul>
[e:loop={'news',15,18,0}]
<?
$newstime=format_datetime($bqr[newstime],'m-d');
if(date('Y-m-d')==date('Y-m-d',$bqr[newstime]))
{
$newstime="<font color=red>$newstime</font>";
}
?>
<li>[<a href="<?=$bqsr[classurl]?>"><?=$bqsr[classname]?></a>]&nbsp;<a href="<?=$bqsr[titleurl]?>"><?=esub($bqr[title],40)?></a><span><?=$newstime?></span></li>
[/e:loop]
</ul>
相关文章
猜你需要