Startpage >> Plog >> RecentCommentDisplaySet

Recent Comment Display Set

<< pLog 迴響模版的迴響編號 | Plog.HomePage | pLog 的簡潔網址 >>


在 最新評論 或 最新迴響 中加入

pLog recentcomment plugin 中,利用 smarty 的判斷,設定時間或日期

修改檔案

修改方法一

1.首先找到插入 recentcomment 的地方,為下列所示
 {assign var=comments value=$recentcomments->getRecentComments(15)}
 {foreach from=$comments item=comment}
2.在 foreach 後,加入這一行
 {assign var=commentDate value=$comment->getDateObject()}
3. 往下尋找 {$comment->getUsername()} 這一個串字,在後面加上 @ 後,斷行,插入下列程式碼。
 {if $locale->formatDate($commentDate,"%D") eq $locale->formatDate($now,"%D")}

{$locale->formatDate($commentDate, "M")}
 {else}
   {$locale->formatDate($commentDate, "%m/%d")}
 {/if}
4. 修改評論 文章標題 與 作者位置,可修考 Reic's place 的設計。

修改方法二

此方法為懶人法,首先請參考 修改方法一 找到 recentcomment 插入的位置,然後將 recentcomment 整個置換成下列程式碼。

 {assign var=comments value=$recentcomments->getRecentComments(15)}
 {foreach from=$comments item=comment}
 {assign var=postid value=$comment->getArticleId()}
 {assign var=commentDate value=$comment->getDateObject()} 
 {assign var=post value=$recentcomments->getCommentArticle($postid)}
 {if $comment->getUserUrl()}
   <li><a title="{$comment->getText()|truncate:150:"..."|escape}" 
       href="{$url->postPermalink($post)}#{$comment->getId()}">
   {$post->getTopic()}</a><div align="right">
   <font style="font-size: 11px;">{$comment->getUsername()} @ 
   {if $locale->formatDate($commentDate,"%D") eq $locale->formatDate($now,"%D")}
     {$locale->formatDate($commentDate, "M")}
   {else}
     {$locale->formatDate($commentDate, "%m/%d")}
   {/if}
   </font></div></li>
 {else}
   <li><a title="{$comment->getText()|truncate:150:"..."|escape}" 
       href="{$url->postPermalink($post)}#{$comment->getId()}">
   {$post->getTopic()}</a>
 <div align="right">
 <font style="font-size: 11px;">{$comment->getUsername()} @ 
 {if $locale->formatDate($commentDate,"%D") eq $locale->formatDate($now,"%D")}
   {$locale->formatDate($commentDate, "M")}
 {else}
   {$locale->formatDate($commentDate, "%m/%d")}
 {/if}
  </a></font></div></li>
 {/if}
 {/foreach}

<< pLog 迴響模版的迴響編號 | Plog.HomePage | pLog 的簡潔網址 >>

頁面最後更新於 2005 年 01 月 11 日,10:43 PM