PHPCMS V9 为今天或几天前文章加new

时间:2021-12-23 03:48:25

今天内发布:

{pc:content action="lists" catid="13" order="listorder DESC" num="10"}
  {loop $data $news}
  <?php $mostnew=$news['inputtime']>(time()-3600*24);?>
  <li style="height: 24px;">
    <a href="{$news['url']}" title="{$news['title']}" {if $mostnew}style="color:#f00;"{/if}>
      {str_cut($news['title'],65,'')}
    </a>
    {if $mostnew}<img src="{IMG_PATH}default/new.jpg" />{/if}
  </li>
  {/loop}
{/pc}

如果是几天前的,则改为:

<?php $mostnew=$news['inputtime']>(time()-3600*24*天数);?>