0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MovableTypeでtableを年別グルーピング化してみた覚書

Last updated at Posted at 2014-02-12

概要

MTテンプレートで、年表を年別にグルーピングしてみた。
投稿した記事の日付で判定しグループ処理にしています。
グループ化するためには、年別で記事のカウントをしなければいけないため
アーカイブテンプレートのブログ記事でテンプレートを作りました。

アーカイブテンプレート

<div class="inner">
<table border="0" cellspacing="0" cellpadding="0" class="companyTbl">
<$mt:SetVar name="currentYear" value="0"$>
<MTArchiveList archive_type="Yearly">
<mt:Entries sort_by="authored_on" sort_order="descend">
<$mt:EntryDate format="%Y" setvar="year"$>
    <tr>
    <mt:If name="year" ne="$currentYear">
        <th rowspan="<$mt:EntriesCount$>"><$mt:Var name="year"$>年</th>
    </mt:If>
        <td><$mt:EntryDate format="%m月"$></td>
        <td><mt:text_item></td>
    <$mt:SetVar name="currentYear" value="$year"$>
    </tr>
</mt:Entries>
</MTArchiveList>
</table>
</div><!--/inner-->
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?