November 10, 2005

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>


Has this tutorial been helpful? Please consider linking to Learning Movable Type at http://learningmovabletype.com/ . Thanks!

Posted by Arvind Satyanarayan on November 10, 2005 to Templates
Comments(1) | Email to a friend | Printer-friendly version


Trackback

If you would like to send a trackback
please use the following URL: http://learningmovabletype.com/cgi-bin/mt32/mt-tb.cgi/446

Comments

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

(Before posting a comment please see the Comments and Trackbacks Policy. Do you need help troubleshooting your weblog? Please post questions and requests for support at the MT Support Forums. Thanks!)




Remember Me?

(you may use HTML tags for style)

Email to a friend

Email this article to:


Your email address:


Message (optional):