帝国CMS列表页内容页时间格式处理的方法
展开阅读全文

一、列表页

列表模板勾选“使用程序代码”,列表内容模板示例如下:

$listtemp='
<li>
<a href="[!--titleurl--]" title="[!--oldtitle--]">[!--title--]</a> 
<span> '.date("Y-m/d H:i:s",$r[newstime]).'</span>
</li> ';

二、内容页

<?=date("YmdHis",$navinfor['newstime'])?>

举例说明:如果我只想显示月日,并中间用"/"分割,那么我们可以如下调用

<?=date("m/d",$navinfor['newstime'])?>

我做的自定义样式如下图:

<div class="post-date pull-left">
<h1 class="font-50 no-margin"><?=date("d",$navinfor['newstime'])?></h1>
<h6 class="no-margin"><?=date("Y-m",$navinfor['newstime'])?></h6>
</div>