6.13 「最近のコメント」を適正に表示する ★

P.459

●テンプレートをカスタマイズする

「最近のコメント」ウィジェットテンプレート(サンプルテンプレート)

<mt:if tag="blogCommentCount">
<dt class="sidetitle">最近のコメント一覧</dt>
<dd class="side">
<ul>
<mt:entriesRecentlyCommented comment_lastn="6">
  <li><a href="<mt:entryPermalink valid_html="1" />"><mt:entryTitle encode_html="1"></a>
    <ul>
    <mt:recentComments sort_order="ascend">
      <li>
        └ <a href="<mt:entryLink archive_type="Individual" />#c<mt:commentID />" title="comment-<mt:commentID />">
          <mt:commentAuthor default="Anonymous">
        </a> <mt:commentDate format="%m/%d" />
      </li>
    </mt:recentComments>
    </ul>
  </li>
</mt:entriesRecentlyCommented>
</ul>
</dd>
</mt:if>
<mt:entriesRecentlyCommented comment_lastn="6" mode="force">

★「最近のコメント」ウィジェットテンプレート(デフォルトテンプレート)

<mt:If tag="mt:BlogCommentCount">
<div class="widget-recent-comments widget">
  <h3 class="widget-header">最近のコメント</h3>
  <div class="widget-content">
    <ul class="widget-list">
  <mt:EntriesRecentlyCommented comment_lastn="6">
      <li><a href="<mt:EntryPermalink valid_html="1" />"><mt:EntryTitle encode_html="1"></a>
        <ul class="recent-comments-list">
    <mt:RecentComments sort_order="ascend">
          <li>
            <a href="<mt:CommentEntry><$mt:EntryPermalink$></mt:CommentEntry>#comment-<$mt:CommentID$>"><$mt:CommentAuthor$> から <mt:CommentEntry><$mt:EntryTitle$></mt:CommentEntry> に対するコメント</a>: <$mt:CommentBody remove_html="1" trim_to="10"$>
          </li>
    </mt:RecentComments>
        </ul>
      </li>
  </mt:EntriesRecentlyCommented>
    </ul>
  </div>
</div>
    </mt:CommentsFooter>
  </mt:Comments>
</mt:If>

「最近のコメント」ウィジェットテンプレート(サンプルテンプレート)

<mt:if tag="blogCommentCount">
<mt:comments sort_order="descend" lastn="6">
  <mt:commentEntry><mt:setVarBlock name="entry_title"><a href="<mt:entryPermalink valid_html="1" />"><mt:entryTitle encode_html="1"></a></mt:setVarBlock></mt:commentEntry>
  <mt:setVarBlock name="entry_comment"><li>└ <a href="<mt:commentEntry><mt:entryLink archive_type="Individual" /></mt:commentEntry>#c<mt:commentID />" title="comment-<mt:commentID />"><mt:commentAuthor default="Anonymous"></a> <mt:commentDate format="%m/%d" /></li></mt:setVarBlock>
  <mt:setVar name="comment_list{$entry_title}" value="$entry_comment" prepend="1" />
  <mt:setVar name="flag" value="0" />
  <mt:loop name="title_list">
    <mt:if name="entry_title" eq="$__value__">
      <mt:setVar name="flag" value="1" />
    </mt:if>
  </mt:loop>
  <mt:unless name="flag">
    <mt:setVar name="push(title_list)" value="$entry_title" />
  </mt:unless>
</mt:comments>
<dt class="sidetitle">最近のコメント一覧</dt>
<dd class="side">
<mt:loop name="title_list">
<ul>
  <li>
    <mt:getVar name="__value__" />
    <ul>
      <mt:getVar name="comment_list{$__value__}" />
    </ul>
  </li>
</ul>
</mt:loop>
</dd>
</mt:if>

ウェブページ

Powered by Movable Type 4.261

このアーカイブについて

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。