« Entry Titles Linked to Permalinks | Main | Background Patterns »

Adding a Calendar to Your MT 3.2 Blog

This tutorial is written by LMT author Arvind Satyanarayan of Movalog.
Tutorial cross posted on Movalog and LMT.

mtbadge-small.gifWith the release of Movable Type version 3.2, Six Apart opted to not include the calendar feature that had been included by default in earlier versions. The reason for this is that calendars, with the days linking to blog archives, are resource intensive; they can significantly lengthen rebuild times. Six Apart has posted the code that was used in previous versions of MT. However, many users have found that simply copying and pasting the code as given doesn't yield a properly formatted calendar.

The following code will create a calendar that will be correctly formatted and styled according your stylesheet. Simply copy the code and put it in the sidebar section of your index template. A good location would be just above <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>

Comments (1)

RJ:

I thought I had posted a comment y/day. Excsue me for reposting knowing that my previous comment may be awaiting approval prior to publish.

Your code for the calendar was exactly what I was looking for. It worked fine.

Now, how can I add a link to the previous and next month.

For instance, we are in Feb, so how can I put a link to 'Jan' or 'Previous' and 'Mar' or 'next', just under the calendar??

Many thanks. Your site and Arvind's Movalog make MT3 easier than it already is!!

- rj

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.)