1个回答
展开全部
{dede:list pagesize='5'}
<!--图片和连接-->
<a target="_blank" class="focus" href="[field:arcurl/]"><img src="[field:picname /]" width="200" height="123" alt="[field:title/]" /></a>
<!--标题和连接-->
<h2><a target="_blank" href="[field:arcurl/]" title="[field:title/]">[field:title/]</a></h2>
<!--点击阅读次数-->
阅读([field:click/])
<!--描述-->
[field:description function='cn_substr(@me,150)'/]
<!--时间,这里有一个自定义函数tranTime -->
[field:pubdate function="tranTime(@me)" /]
{/dede:list}
时间自定义函数,打开include/extend.func.php 放到最末尾
function tranTime($time) {
$rtime = date("m-d H:i",$time);
$htime = date("H:i",$time);
$time = time() - $time;
if ($time < 60) {
$str = '刚刚';
}
elseif ($time < 60 * 60) {
$min = floor($time/60);
$str = $min.'分钟前';
}
elseif ($time < 60 * 60 * 24) {
$h = floor($time/(60*60));
$str = $h.'小时前 '.$htime;
}
elseif ($time < 60 * 60 * 24 * 3) {
$d = floor($time/(60*60*24));
if($d==1)
$str = '昨天 '.$rtime;
else
$str = '前天 '.$rtime;
}
else {
$str = $rtime;
}
return $str;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询