九月 14, 2006

[外掛] 讓祕密文章不在「摘要頁」或 RSS 中顯示

引用文章自

http://forum.lifetype.org.tw/index.php?topic=918.0&highlight=secret


Mark Wu 提到:

你直接把 summary 中的 post.template 改為


// 直接抓取 password_protected 的 value object
{assign var=isSecretField value=$post->getFieldObject("password_protected")}
// 如果 value object 是空的,或是沒有設定密碼保護 !=1,就顯示文章
{if empty($isSecretField) || $isSecretField->getValue() != 1}


{assign var="blog" value=$post->getBlogInfo()}
{assign var="request" value=$blog->getBlogRequestGenerator()}
<h5>{$post->getTopic()}</h5>
<div class="subtitle">
{$locale->tr("blog")} <a href="{$request->blogLink()}">{$blog->getBlog()}</a>
</div>
<p>
{$post->getText()|strip_tags|truncate:200:"..."}
</p>
<div class="peu">

{assign var="postCategories" value=$post->getCategories()}
{assign var="postOwner" value=$post->getUserInfo()}
{assign var="postDate" value=$post->getDateObject()}
<a href="{$request->postPermalink($post)}" class="noborder">
<img src="imgs/post.png" width="10" height="11" alt="Permalink" />
</a>
&nbsp;{$locale->tr("posted_by")} {$postOwner->getUsername()}, {$locale->formatDate($postDate,"%e %B %Y")} |
<img src="imgs/comment.png" width="11" height="10" alt="{$locale->tr("comments")}" />&nbsp;
<a href="{$request->postPermalink($post)}#comments">{if $post->getTotalComments() eq 0}{$locale->tr("comment on this")}{else}{$post->getTotalComments()} {$locale->tr("comments")|capitalize}{/if}</a>
<br style="clear: both;" />
</div>

{/if}



粗體字是另外加上的! rss 的部分請以此類推!記得前面有 // 的是註解,你不要一起 copy 上去了!



研習中心版摘要頁的改法有一點不同

{assign var=isSecretField value=$post->getFieldObject("password_protected")}

{if empty($isSecretField) || $isSecretField->getValue() != 1}

<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#F3F3F3"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/blog_icon.gif"> {assign var="blog" value=$post->getBlogInfo()}
{assign var="request" value=$blog->getBlogRequestGenerator()}
<a href="{$request->postPermalink($post)}" class="post_title">{$post->getTopic()}</a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td>{$post->getText()|strip_tags|truncate:300:"...":false}</td>
</tr>
</table></td>
</tr>
<tr>
<td align="right" bgcolor="#FFFFFF">
{assign var="postCategories" value=$post->getCategories()}
{assign var="postOwner" value=$post->getUserInfo()}
{assign var="postDate" value=$post->getDateObject()}
<img src="imgs/post.png" width="10" height="11" alt="Permalink">
{$locale->tr("posted_by")}:<a href="{$request->blogLink()}" title="{$locale->tr("blog")}:{$blog->getBlog()}">{$postOwner->getUsername()}</a> , {$locale->formatDate($postDate,"%Y-%B-%e")} |
<img src="imgs/comment.png" width="11" height="10" alt="{$locale->tr("comments")}" />&nbsp;
<a href="{$request->postPermalink($post)}#comments">{if $post->getTotalComments() eq 0}{$locale->tr("comment on this")}{else}{$post->getTotalComments()} {$locale->tr("comments")|capitalize}{/if}</a>
</td>
</tr>
</table>
<br>
{/if}

紅色程式部份直接加在最前及最後就可以了

延伸閱讀:

[Lifetype] 密碼保護修正的方法兩種
http://twntwn.info/blog/ajer001/archives/260

[Lifetype] 選單之密碼保護修正

http://twntwn.info/blog/ajer001/archives/1144


發佈者: 陳怡杰 老師 at 13:21│  點閱次數 (3978)│ 修改文章管理迴響迴響 (2)95年9月-部落格系統班
回應文章

1

Re:[外掛] 讓祕密文章不在「摘要頁」或 RSS 中顯示

老師你好
我用了祕密文章不在首頁出現
按照上面的方法做
但是在rss中還是會出現
請問在rss中不出現祕密文章怎麼弄呢
謝謝

Posted by jangwanyi at 19/09/2006, 08:01

2

阿杰老師的回答:Re:[外掛] 讓祕密文章不在「摘要頁」或 RSS 中顯示

已經有完整的改法啦! :)

http://www.tiec.tp.edu.tw/lifetype/post/102/5862

Posted by 陳怡杰 老師 at 22/09/2006, 00:04