MT4.23:MTCSデフォルトテンプレート解析(06)
MTCSのテンプレートの解析覚え書き。コミュニティブログとコミュニティ掲示板の大きな相違点を書く。
前の記事は以下。
例としてメインインデックスページのテンプレートを題材とする。
コミュニティブログのテンプレートコードは以下。
<mt:SetVarBlock name="title"><$mt:BlogName encode_html="1"$></mt:SetVarBlock>
<mt:SetVarBlock name="html_head" append="1">
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="<$mt:Link template="rsd"$>" />
</mt:SetVarBlock>
<$mt:Include module="ヘッダー" body_class="mt-main-index"$>
<mt:Entries>
<$mt:Include module="ブログ記事の概要"$>
</mt:Entries>
<$mt:Include module="コンテンツのナビゲーション"$>
<$mt:Include module="フッター"$>
対してコミュニティ掲示板のテンプレートコードは以下。
<mt:SetVarBlock name="page_title">掲示板メイン</mt:SetVarBlock>
<mt:SetVarBlock name="title"><$mt:BlogName encode_html="1"$></mt:SetVarBlock>
<mt:SetVarBlock name="html_head">
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="<$mt:Link template="rsd"$>" />
</mt:SetVarBlock>
<$mt:Include module="ヘッダー" body_class="mt-main-index"$>
<$mt:Include module="コンテンツヘッダー"$>
<$mt:Include module="人気のブログ記事"$>
<$mt:Include module="ブログ記事一覧"$>
<$mt:Include module="コンテンツのナビゲーション"$>
<$mt:Include module="フッター"$>
両者の相違点とか
page_title、title、html_head変数の記述が異なる。まあこれはどうでもいい。なんとでもなる。
次にインクルード文の相違点。コミュニティ掲示板にはmt:Entriesブロックで括られた「ブログ記事の概要」インクルード文があるが、これは単に数件のブログ記事の概要をバーっと表示するだけで、これまでのブログのテンプレートとたいして変わりはない。
問題はコミュニティ掲示板で増えた以下のインクルード文。
- コンテンツヘッダー
- 人気のブログ記事
- ブログ記事一覧
ひとつひとつソースを見てみる。
コンテンツヘッダー
早い話が下図の部分。
ソースは以下。
<mt:If tag="EntryCategory">
<mt:EntryCategories>
<mt:SetVarBlock name="query_string">?<$mt:CategoryID$>;<$mt:CategoryLabel escape="url"$></mt:SetVarBlock>
</mt:EntryCategories>
<mt:Else tag="CategoryLabel">
<mt:SetVarBlock name="query_string">?<$mt:CategoryID$>;<$mt:CategoryLabel escape="url"$></mt:SetVarBlock>
</mt:If>
<div class="content-header">
<mt:If name="content_header_url"><a href="<$mt:Var name="content_header_url"$>"></mt:If><<$mt:Var name="content_header_title_tag" default="h1"$> id="page-title" class="<$mt:Var name="content_header_class"$>"><mt:If name="content_header_title"><$mt:Var name="content_header_title"$><mt:Else><$mt:Var name="page_title"$></mt:If></<$mt:Var name="content_header_title_tag" default="h1"$>><mt:If name="content_header_url"></a></mt:If>
<div class="create-entry"><a href="<$mt:Link template="entry_create"$><$mt:Var name="query_string"$>">トピックを投稿</a></div>
</div>
人気のブログ記事
ソース中に「mt:Entries sort_by="score" namespace="community_pack_recommend" limit="1"」とあるので、早い話が、一番スコアがいいブログ記事が一件のみ、コメントやプロフィール画像などのメタ情報込みで表示される。
下図の部分。
<mt:Entries sort_by="score" namespace="community_pack_recommend" limit="1">
<mt:EntriesHeader>
<div id="popular-entry" class="entry">
<h2>目立ったトピック</h2>
</mt:EntriesHeader>
<div class="entry-asset">
<div class="entry-asset-inner">
<div class="entry-header">
<h3 class="entry-title"><a href="<$mt:EntryPermalink$>"><$mt:EntryTitle$></a><mt:Unless name="category_archive"> <span class="category-name"><a href="<$mt:EntryLink archive_type="Category"$>"><$mt:EntryCategory$></a></span></mt:Unless></h3>
</div>
<$mt:Include module="プロフィール画像" userpic_size="50"$>
<div class="asset-meta">
<span class="byline"><span class="vcard author"><a href="<$mt:Var name="profile_view_url" encode_html="1"$><$mt:EntryAuthorID$>"><$mt:EntryAuthorDisplayName encode_html="1"$></a></span> (<abbr class="published" title="<$mt:EntryDate format_name="iso8601"$>"><$mt:EntryDate format="%b %e, %Y at %l:%M %p"$></abbr>)</span>
<a href="javascript:void(0)" onclick="return mtScore(<$mt:EntryID$>)" id="scoring-id-<$mt:EntryID$>" class="scoring">
<span id="scoring-vote-<$mt:EntryID$>" class="scoring-vote">票</span>
<span id="scoring-score-<$mt:EntryID$>" class="scoring-score"><$mt:EntryScore namespace="community_pack_recommend" singular="1" plural="#" none="0"$></span>
<span id="scoring-score-label-<$mt:EntryID$>" class="scoring-score-label"><$mt:EntryScore namespace="community_pack_recommend" singular="票" plural="票" none="票"$></span>
</a>
</div>
<div class="entry-body">
<$mt:EntryExcerpt$>
</div>
<div class="entry-comments">
<p class="comment-count icon-comment"><a href="<$mt:EntryPermalink$>#comments"><$mt:EntryCommentCount singular="返信(1)" plural="返信(#)" none="返信する"$></a></p>
<div class="last-comment">
<mt:If tag="EntryCommentCount">
<h4>最新の返信</h4>
<mt:Comments lastn="1">
<$mt:Include module="プロフィール画像" userpic_size="36" userpic_type="commenter"$>
<div class="asset-meta">
<a href="<$mt:EntryPermalink$>#comment-<$mt:CommentID$>" title="この返信のURL"><abbr title="<$mt:CommentDate format_name="iso8601"$>"><$mt:CommentDate format="%b %e, %Y"$></abbr></a>
<div class="byline"><span class="vcard author"><mt:IfCommenterIsAuthor><a href="<$mt:Var name="profile_view_url" encode_html="1"$><$mt:CommenterID$>"><$mt:CommenterName encode_html="1"$></a><mt:Else><$mt:CommentAuthorLink$></mt:IfCommenterIsAuthor></span></span></div>
</div>
</mt:Comments>
</mt:If>
</div>
</div>
</div>
</div>
<mt:EntriesFooter>
</div>
</mt:EntriesFooter>
</mt:Entries>
ブログ記事一覧
コード中に「mt:Entries limit="15" sort_by="modified_on" unique="1"」とかある。ブログ記事を新しい順に15件並べているようである。コードから、プロフィール画像やコメント数などの情報も記述してある。ここ、テーブルタグで表組みしてあるので、変えてもよいかと。
下図の部分。
<mt:Entries limit="15" sort_by="modified_on" unique="1">
<mt:EntriesHeader>
<table id="entry-table">
<thead>
<tr>
<th class="title">最新トピック</th>
<th class="comment-count">返信</th>
<th class="last-comment">最新の返信</th>
</tr>
</thead>
<tbody>
</mt:EntriesHeader>
<tr>
<td class="title">
<$mt:Include module="プロフィール画像" userpic_size="36"$>
<div class="entry entry-asset">
<div class="entry-title"><a href="<$mt:EntryPermalink$>"><$mt:EntryTitle$></a><mt:Unless name="category_archive"> <span class="category-name"><mt:EntryCategories><a href="<$mt:CategoryArchiveLink$>" rel="tag" title="<$mt:CategoryDescription escape="html"$>"><$mt:CategoryLabel$></a></mt:EntryCategories></span></mt:Unless></div>
<div class="asset-meta">
<span class="byline"><span class="vcard author"><a href="<$mt:Var name="profile_view_url" encode_html="1"$><$mt:EntryAuthorID$>"><$mt:EntryAuthorDisplayName encode_html="1"$></a></span> (<abbr class="published" title="<$mt:EntryDate format_name="iso8601"$>"><$mt:EntryDate format="%b %e, %Y at %l:%M %p"$></abbr>)</span>
<a href="javascript:void(0)" onclick="return mtScore(<$mt:EntryID$>)" id="scoring-id-<$mt:EntryID$>" class="scoring">
<span id="scoring-vote-<$mt:EntryID$>" class="scoring-vote">票</span>
<span id="scoring-score-<$mt:EntryID$>" class="scoring-score"><$mt:EntryScore namespace="community_pack_recommend" singular="1" plural="#" none="0"$></span>
<span id="scoring-score-label-<$mt:EntryID$>" class="scoring-score-label"><$mt:EntryScore namespace="community_pack_recommend" singular="票" plural="票" none="票"$></span>
</a>
</div>
</div>
</td>
<td class="comment-count"><a href="<$mt:EntryPermalink$>#comments"><$mt:EntryCommentCount$></a></td>
<td class="last-comment">
<mt:Comments lastn="1">
<$mt:Include module="プロフィール画像" userpic_size="36" userpic_type="commenter"$>
<div class="asset-meta">
<a href="<$mt:EntryPermalink$>#comment-<$mt:CommentID$>" title="この返信のURL"><abbr title="<$mt:CommentDate format_name="iso8601"$>"><$mt:CommentDate format="%b %e, %Y"$></abbr></a>
<div class="byline"><span class="vcard author"><mt:IfCommenterIsAuthor><a href="<$mt:Var name="profile_view_url" encode_html="1"$><$mt:CommenterID$>"><$mt:CommenterName encode_html="1"$></a><mt:Else><$mt:CommentAuthorLink$></mt:IfCommenterIsAuthor></span></div>
</div>
<mt:Else>
<mt:IfCommentsAccepted>
<a class="icon-comment" href="<$mt:EntryPermalink$>#comment">返信</a>
<mt:Else>
<span class="comments-closed">終了</a>
</mt:IfCommentsAccepted>
</mt:Comments>
</td>
</tr>
<mt:EntriesFooter>
</tbody>
</table>
</mt:EntriesFooter>
<mt:Else>
<mt:If tag="EntriesCount">
<mt:Else>
<p><a href="<$mt:Link template="entry_create"$><mt:If tag="CategoryLabel" default="">?<$mt:CategoryID$>;<$mt:CategoryLabel escape="url"$></mt:If>">掲示板にトピックを投稿してください。</a></p>
</mt:If>
</mt:Entries>
- カテゴリ:213テンプレート
トラックバック(0)
このブログ記事を参照しているブログ一覧: MT4.23:MTCSデフォルトテンプレート解析(06)
このブログ記事に対するトラックバックURL:
- Categories
- Entries
-
- MT4.23:MTCSデフォルトテンプレート解析(06)
- MT4.23:MTCSデフォルトテンプレート解析(05)
- MT4.23:MTCSデフォルトテンプレート解析(04)
- MT4.23:MTCSデフォルトテンプレート解析(03)
- MT4.23:MTCSデフォルトテンプレート解析(02)
- MT4.23:MTCSデフォルトテンプレート解析(01)
- MTOS4.2向けテンプレートを作成する(3) 手抜きで行くには
- MTOS4.2向けテンプレートを作成する(2) XHTML構造とモジュール名
- MTOS4.2向けテンプレートを作成する(1) イントロ
- MT4.1:テンプレート配布(v1.0.5)
- MT4.1:テンプレートへパンくずリストを追加
- MT4.1:テンプレート配布
コメントする