News
2009年10月22日
エントリー本文
include_with_website モディファイア
Posted at October 22,2009 1:55 AM
Category:[5.0, テンプレートタグ]
Tag:[exclude_websites, include_websites, include_with_website, MovableType, site_ids]
Category:[5.0, テンプレートタグ]
Tag:[exclude_websites, include_websites, include_with_website, MovableType, site_ids]
Movable Type 5 では include_with_website モディファイアが追加されています。
このモディファイアは、自ウェブサイトのIDを include_blogs="site" というモディファイアの値に加えるものです。次のように設定すれば、ウェブサイト配下のブログ名と自ウェブサイト名を出力します。
<mt:Blogs include_blogs="site" include_with_website="1">
<mt:BlogName />
</mt:Blogs>
include_with_website モディファイアは、include_blogs モディファイアが使える以下のテンプレートタグで使えると思います(他にも使えるかもしれません)。
- MTAssets
- MTAuthors
- MTBlogs
- MTCategories
- MTBlogCategoryCount
- MTComments
- MTBlogCommentCount
- MTEntries
- MTAuthorEntryCount
- MTBlogEntryCount
- MTPings
- MTBlogPingCount
- MTTags
- MTTagSearchLink
- MTTagRank
- MTWebsites
また、以下のモディファイアも追加されています(上記のテンプレートタグで利用可能)。
- site_ids
- include_websites
- exclude_websites
ちなみに、デフォルトテンプレートの「最近のコメント(下)」を見ると、MTIf タグ(厳密には、MTIf タグの tag モディファイアに上記のテンプレートタグを使用した場合)にも include_with_website モディファイアを(つまり include_blogs="site" も)適用できるようです。
<mt:If tag="BlogCommentCount" include_blogs="site" include_with_website="1">
<mt:Comments lastn="10" sort_order="descend" include_blogs="site" include_with_website="1">
<mt:CommentsHeader>
<div class="widget-recent-comments widget">
<h3 class="widget-header">最近のコメント</h3>
<div class="widget-content">
<ul>
</mt:CommentsHeader>
<li><strong><$mt:CommentAuthor$>:</strong> <$mt:CommentBody remove_html="1" words="10"$> <a href="<$mt:CommentLink$>" title="<mt:CommentEntry><$mt:EntryTitle$></mt:CommentEntry>へのコメント">続きを読む</a></li>
<mt:CommentsFooter>
</ul>
</div>
</div>
</mt:CommentsFooter>
</mt:Comments>
</mt:If>
このサブテンプレートは、自ウェブサイトの(ウェブページへの)コメントも含めて、コメントが1件以上投稿(公開)されていれば、MTIf タグブロック内を実行するようになっています。MTIf タグの条件と整合するよう、中にある MTComments タグにも同じモディファイアを適用しています。
ということで、MTIf タグに設定できるモディファイアがさらに増えました。
Posted by yujiro
ReTweet This!
この記事を読んだ人はこんな記事も読んでいます
人気エントリー
Hatena Hot Entries
Hatena Entries
トラックバックURL
コメントする
greeting
