|
|
第1行: |
第1行: |
- | == 迴響的 RSS ==
| |
- | 原本 Lifetype 只有文章的 RSS,並沒有迴響的。但是 ypchen 把他做出來了,快來使用吧。
| |
| | | |
- | *注意事項:
| |
- | :必須搭配 [[LifeType_1.0/Plugins/recentcomments|最新迴響]] 這個外掛一起使用。
| |
- |
| |
- | *使用方法:
| |
- | :1. 在 /template/rss/ 下面新增一個 comment_rss.template 檔案,將下面的語法放入(或是到 ypchen 的網站下載該檔案)。
| |
- | <smarty>
| |
- | <?xml version="1.0" encoding="{$locale->getCharset()}"?>
| |
- | <?xml-stylesheet href="{$url->getUrl("/styles/rss.css")}" type="text/css"?>
| |
- | <rss version="2.0"
| |
- | xmlns:content="http://purl.org/rss/1.0/modules/content/"
| |
- | xmlns:dc="http://purl.org/dc/elements/1.1/"
| |
- | >
| |
- | {$locale->setLocale("en_UK")}
| |
- | <channel>
| |
- | <title>{$blog->getBlog()|escape}: {$locale->tr("comments")|escape}</title>
| |
- | <link>{$url->blogLink()}</link>
| |
- | <description>{$blog->getAbout()|escape}</description>
| |
- | <pubDate>{$locale->formatDate($now, "%a, %d %b %Y %H:%M:%S %O")}</pubDate>
| |
- | <generator>http://www.lifetype.net</generator>
| |
- | {assign var=comments value=$recentcomments->getRecentComments()}
| |
- | {foreach from=$comments item=comment}
| |
- | <item>
| |
- | {assign var=commentpostid value=$comment->getArticleId()}
| |
- | {assign var=commentpost value=$recentcomments->getArticle($commentpostid)}
| |
- | {assign var="passwordObj" value=$commentpost->getFieldObject("password_field")}
| |
- | {if $passwordObj != "" && $passwordObj->getValue() != ""}
| |
- | <title>Secret post: comment title unavailable</title>
| |
- | <description>Secret post: comment content unavailable</description>
| |
- | {else}
| |
- | {if $comment->getTopic() != ""}
| |
- | {assign var=commenttitle value=$comment->getTopic()}
| |
- | {else}
| |
- | {assign var=commenttitle value="(No Title)"}
| |
- | {/if}
| |
- | <title>{$commenttitle|escape}</title>
| |
- | <description>{$comment->getText()|escape}</description>
| |
- | {/if}
| |
- | <link>{$url->postPermalink($commentpost)}#{$comment->getId()}</link>
| |
- | <comments>{$url->postPermalink($commentpost)}#{$comment->getId()}</comments>
| |
- | <guid>{$url->postPermalink($commentpost)}#{$comment->getId()}</guid>
| |
- | {assign var="commentOwner" value=$comment->getUsername()}
| |
- | <dc:creator>{$commentOwner}</dc:creator>
| |
- | {foreach from=$commentpost->getCategories() item=category}
| |
- | <category>{$category->getName()|escape}</category>
| |
- | {/foreach}
| |
- | {assign var=commentDate value=$comment->getDateObject()}
| |
- | {assign var=commentDateF value=$locale->formatDate($commentDate, "%a, %d %b %Y %H:%M:%S %O")}
| |
- | <pubDate>{$commentDateF}</pubDate>
| |
- | <source url="{$url->rssLink("rss20comments")}">{$blog->getBlog()|escape}</source>
| |
- | </item>
| |
- | {/foreach}
| |
- | </channel>
| |
- | </rss>
| |
- | </smarty>
| |
- |
| |
- | :2. 編輯 header.template 和 sidebar的模板,參造原本的 rss 語法,新增一個位址為 {$url->rssLink("comment_rss")} 的連結。
| |
- |
| |
- |
| |
- | 修改自 [http://blog.nclab.tw/2_ypchen/post/178/2005/11/08 演化的世界、變動的人生]。
| |