pLog 0.32時是看markwu網誌上所寫的教學文章,
我以此為精神寫出在pLog 1.0如何安裝,
另加入迴響人的張貼時間,跟官方sample有點小小差異。
安裝:
1.下載recentcomments.zip解壓縮至/plugins/recentcomments/
2.至/管理面版/個人網誌設定/外掛中心/確認plugin是否已載入成功
記得refresh畫面幾次。
3.至/管理面版/個人網誌設定/最近迴響設定內,啟動外掛及設定最新迴響顯示數量。
4.修改模版,加入以下代碼(以grey模版為例):
<div class="Sidetitle">
<h4>{$locale->tr("recentcomments")}</h4>
</div>
<p>
{if $recentcomments->isEnabled()}
{assign var=comments value=$recentcomments->getRecentComments()}
{foreach from=$comments item=comment}
{assign var=commentpostid value=$comment->getArticleId()}
{assign var=commentpost value=$recentcomments->getArticle($commentpostid)}
{assign var=commentdate value=$comment->getDateObject()}
<li><a title="{$comment->getText()|truncate:100:"..."|strip_tags}" href="{$url->postPermalink($commentpost)}#{$comment->getId()}">{$comment->getUsername()}@{$commentpost->getTopic()}</a> ({$locale->formatDate($commentdate, "%m/%d")})</li>
{/foreach}
{else}
Warning: {$locale->tr("RecentComments")} is required or enabled.
{/if}
</p>
4.完成。
執行畫面: