帝国cms列表中 列表内容中显示按照汉字年 月 日 时分秒的方法
如下图所示:
解决办法:用两个date()函数分别格式化发布时间
在列表内容模板页
列表内容模版支持时间分开显示
列表模板启用list.var支持程序代码,然后用:
列表内容调用时间
$listtemp=' 月份:'.date("Y-m",$r[newstime]).'<br>日:'.date("d",$r[newstime]).'其它模板内容';
完成的调用代码
$newstime=$r[newstime];//获取信息发布时间
$year=format_datetime($newstime,"Y");//单独获取年
$month=format_datetime($newstime,"m");//单独获取月
$day=format_datetime($newstime,"d");//单独获取日
$listtemp='<div class="new_li">
<div id="xinwenDate"><p class="day">'.$day.'</p><p class="month">'.$month.'</p><p class="year">'.$year.'年</p></div>
<div id="xinwenList">
<p class="xinwenTitle"><a href="[!--titleurl--]">[!--title--]</a></p>
<div class="xinwenText">[!--smalltext--]</div>
</div>
</div>';
当前目录:帝国CMS笔记
帝国cms列表中 列表内容中显示按照汉字年 月 日 时分秒的方法
帝国CMS笔记 2025-04-03 15:46:05