dedecms織夢(mèng)把時(shí)間標(biāo)簽修改成“今天、明天、后天”代碼如下
01 |
[field:senddate runphp= 'yes' ] |
05 |
$threeday = 3600 * 72; |
06 |
if (($ntime - @me) < $oneday) @me = "今天" ; |
07 |
elseif(($ntime - @me) < $twoday) @me = "昨天" ; |
08 |
elseif(($ntime - @me) < $threeday) @me = "前天" ; |
10 |
@me=MyDate( 'm-d' ,@me); |
12 |
[field:senddate function =MyDate( 'H:s' ,@me)/] |
|
上面一段是實(shí)現(xiàn)日期,如果是今天的就顯示今天,昨天就顯示昨天,在配合下面的一段時(shí)間標(biāo)簽,就可以實(shí)現(xiàn)“今天 11:41 ”這樣的效果,當(dāng)文章的發(fā)布時(shí)間不在三天之內(nèi)時(shí)就顯示時(shí)間日期,像這樣“05-24 11:41”。pubdate字段同樣適用。