« 有问题吗? | Main | 给文章标题增加Permalinks »

给MT3.2增加年历表

MT3.2的默认模板已取消了首页的年历表,官方提供了以前版本的代码,现在我们来修改这些代码来给你的BLOG增加一个年历表。
编辑主模板,在<div class="module-search module">前面加入以下代码:

<div class="module-calendar module">
<h2 class="module-header"><$MTDate format="%B %Y"$></h2>
<div class="module-content">
<table summary="Monthly calendar with links to each day's posts">

<tr>
<th abbr="Sunday">Sun</th>
<th abbr="Monday">Mon</th>
<th abbr="Tuesday">Tue</th>
<th abbr="Wednesday">Wed</th>
<th abbr="Thursday">Thu</th>
<th abbr="Friday">Fri</th>
<th abbr="Saturday">Sat</th>
</tr>
<MTCalendar>
<MTCalendarWeekHeader><tr></MTCalendarWeekHeader>
<td>
<MTCalendarIfEntries>
<MTEntries lastn="1">
<a href="<$MTEntryPermalink$>"><$MTCalendarDay$></a>
</MTEntries>
</MTCalendarIfEntries>
<MTCalendarIfNoEntries>
<$MTCalendarDay$>
</MTCalendarIfNoEntries>
<MTCalendarIfBlank> </MTCalendarIfBlank></td>
<MTCalendarWeekFooter></tr></MTCalendarWeekFooter>
</MTCalendar>
</table>
</div>
</div>
 

如果你想使有发表文章的日期突显,比如以粗体显示,可以将代码行:
<a href="<$MTEntryPermalink$>"><$MTCalendarDay$></a>
改为:
<a href="<$MTEntryPermalink$>"><b><$MTCalendarDay$></b></a>

以上代码来自于http://www.learningmovabletype.com这是我常去学习的一个MT站点。

Tags:

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)