引用文章自
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>
{$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")}" />
<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")}" />
<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