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!
- MTInclude タグの name モディファイア
- Movable Type の特殊変数の入れ子
- ブロックタグにelseタグを組み込んで判定する
- Movable Type 5 におけるウェブサイトとブログの複数指定方法
- ウェブサイトとブログでグローバルナビゲーションを共有する
- regex_replace モディファイアをダイナミックパブリッシングで利用する場合の注意
- Movable Type のアーカイブページへのリンクを相対パス(ホストからの相対URL)で表示する
- Movable Type の記事中の&を&に変更する方法
- Movable Type テンプレートタグの簡略化まとめ
- Movable Type のテンプレートタグでよくある5つの書き間違い
- Movable Type で他のブログのテンプレートモジュール・ウィジェットを利用する
- Movable Type のブロックタグにファンクションタグで使うモディファイアを指定する
- MTIf タグの test モディファイアで Perl の式を利用する
- MTIf タグの tag モディファイアでテンプレートタグの値を直接参照する
- Movable Type 4.1 / MTOS における配列とハッシュの利用方法
- MTIf タグの like 属性について
- MTSetVarBlock と MTSetVarTemplate の違いについて
- strip 属性で日付の空白を削除する
- MTIgnore タグ
- エントリーで table タグを記述する場合の注意
この記事を読んだ人はこんな記事も読んでいます
人気エントリー
Hatena Hot Entries
Hatena Entries
トラックバックURL
コメントする
greeting
