Ms7 Search
Google 搜尋 翻譯
calendar
« 九月 2024 »
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30            
近期文章
文章分類
網站連結
Syndicate

« | »

置頂文章公告 plugins stickyposts

2008-11-30 @ 20:13 in LifeType,Moodle

增加置頂文章公告的外掛,我所用的是 stickyposts 1.2 的版本,依照 readme 的說明,先在文章分類新增一個置頂文章公告的分類,在個人網誌設定=>網誌最近活動管理=>置頂及公告文章設定 中啟動外掛及設定置頂文章分類,然後在樣本中的 main.template 中加入紅色部份

{if $category}<h2>{$locale->tr("category")}: {$category->getName()}</h2>{/if}

{if empty($showAll) && $stickyposts->isEnabled()}
  {assign var=stickys value=$stickyposts->getArticles('sticky')}
{if $stickys|@count > 0}
<div class="post">
<h2>置頂文章</h2>
<div class="posthead">
  {foreach from=$stickys item=post}
  <a href="{$url->postPermalink($post)}">{$post->getTopic()}</a>&nbsp;
  {/foreach}
</div>
</div>
{/if}
{/if}


 {foreach from=$posts item=post}
我的加法是配合樣本格式,及判斷如果沒有置頂公告文章就不顯示區塊,與 readme 有一點不一樣,因為我覺得這個功能對我個人來說不太可能用到,如果沒有置頂文章,卻佔用一個空block區塊,感覺上很奇怪,所以加入,如果沒有置頂文章就不顯示的判斷

發表迴響
 authimage