1. 安裝的方法請參考 Mark「為pLog加上置頂文章」的說明,下列僅出不同處。
  2. 請下載 lss 貼心小改版的 plog-plugin-stickyposts-20041101.zip(只有置頂分類)plog-plugin-stickyposts-20041102.zip(有公告分類及置頂分類)
  3. 安裝後,請確定外掛程式中心有stickyposts的plugin。
  4. 點選stickyposts後面的configure,進入configure介面。
  5. 在列出的文章分類裡,由list box裡選取分類做為公告分類(Announcements)及置頂分類(Sticky Category),並按下「Save Setting」按鈕儲存設定。
  6. 只有置頂分類的plugin,請按Mark文章裡的方法修改樣版,唯一的不同如下:

 

  將下面的程式加到 main.template 中:
<h3>置頂文章</h3>
{assign var=stickyposts value=$stickyposts->getStickyPosts('')}
{foreach from=$stickyposts item=stickypost}
{assign var="stickypostDate" value=$stickypost->getDateObject()}
{assign var="stickypostOwner" value=$stickypost->getUserInfo()}
<li><a href="{$url->postLink($stickypost)}">{$stickypost->getTopic()}
({$stickypost->getTotalComments()})</a> by
{$stickypostOwner->getUsername()} @
{$locale->formatDate($stickypostDate,"%Y/%m/%d")}</li>
{/foreach}
<p />

 

  1. 使用新版有兩個分類的人,請在要放置公告及置頂的樣版裡適當位置加入下面的code:

 

 <h3>Announcements</h3>
{assign var=annposts value=$stickyposts->getAnnouncePosts()}
{foreach from=$annposts item=annpost}
{assign var="annpostDate" value=$annpost->getDateObject()}
{assign var="annpostOwner" value=$annpost->getUserInfo()}
<li><a href="{$url->postLink($annpost)}">{$annpost->getTopic()}
({$annpost->getTotalComments()})</a> by {$annpostOwner->getUsername()} @
{$locale->formatDate($annpostDate,"%Y/%m/%d")}</li>
{/foreach}
<p />
<h3>Sticky Posts</h3>
{assign var=stickyposts value=$stickyposts->getStickyPosts()}
{foreach from=$stickyposts item=stickypost}
{assign var="stickypostDate" value=$stickypost->getDateObject()}
{assign var="stickypostOwner" value=$stickypost->getUserInfo()}
<li><a href="{$url->postLink($stickypost)}">{$stickypost->getTopic()}
({$stickypost->getTotalComments()})</a> by {$stickypostOwner->getUsername()} @
{$locale->formatDate($stickypostDate,"%Y/%m/%d")}</li>
{/foreach}
<p />

感謝: Mark(173) and lss(99) 
來源:reic部落格

    全站熱搜

    jianmin2 發表在 痞客邦 留言(0) 人氣()