I've always loved the appearance of the calendars to see where I'm at in my blogging history. Before this time, I've always hand coded out tables to point to my archives, or added on to previous tables that I had from Blogger/Greymatter. But now that all of my archives are in Movable Type, I finally got a chance to put the tables together all on one page. Calendar Archives.
Here's how I do it.
Note: I'm using a modification on Dawn's calendar tutorial to get alternating colors in the calendar.
I created a new Archive Template named Date-Based Calendar Archive. It generates the calendar for each month.
<div class="calendar">
<div align="center"><B><$MTArchiveDate format="%B, %Y"$></B></div>
<TABLE BORDER="0" CELLPADDING="2" CELLSPACING="0" WIDTH="140"><TR>
<TD class="calhead">S</TD><TD class="calhead">M</TD><TD class="calhead">T</TD><TD class="calhead">W</TD><TD class="calhead">T</TD><TD class="calhead">F</TD><TD class="calhead">S</TD></TR>
<MTCalendar month="this">
<MTCalendarWeekHeader><TR HEIGHT="20"><? $counter = 0; ?></MTCalendarWeekHeader>
<TD class="calbody" style="<MTCalendarIfToday>background-color: #4e4e4e;</MTCalendarIfToday>" BGCOLOR="<? echo $counter++ % 2 ? '#222222' : '#111111' ?>"><MTCalendarIfEntries>
<a href="http://kadyellebee.com/mt/past/<$MTEntryDate format="%Y/%m/%d.php"$>" title="<MTEntries> | <$MTEntryTitle encode_html="1"$> | </MTEntries>">
<$MTCalendarDay$></A></MTCalendarIfEntries>
<MTCalendarIfNoEntries><$MTCalendarDay$></MTCalendarIfNoEntries>
<MTCalendarIfBlank><BR></MTCalendarIfBlank>
</td><MTCalendarWeekFooter></tr>
</MTCalendarWeekFooter></MTCalendar>
</table></div>
I bolded the path to my archives, because you'd want to change that – Because I have daily archives turned on, my calendar links to that day's posts. And I have an archive filename (daily: <$MTArchiveDate format="%Y/%m/%d.php"$>) turned on to point to a specific location. If you don't have daily archiving turned on, you can still use this, you just need to modify it a bit first.
Now that I've created this template, I go into the Blog Config under Archiving and clicked Add New… to add this to the list. I selected Monthly and Date-based Calendar Archive Template to pair these things together. I gave it an archive filename, for easy linking in my master template: <$MTArchiveDate format="%Y/%m/cal.php"$>.
Putting it all together on the Master Calendar page took a bit of PHP and some help from my husband – his PHP knowledge goes much beyond mine! I wanted a 3-column format, with the oldest calendar on the top. Because I wanted to use MT to generate this list, I created a new index template named Master Calendar Archives and set its output file to cal.php. Inside my formatting, here's the contents:
<table>
<?php
$cals = '<MTArchiveList archive_type="Monthly"><$MTArchiveDate format="%Y/%m/cal.php"$>,</MTArchiveList>';
$cals = strrev($cals);
$i=0;
$tok = strtok($cals, ',');
do {
if ($i%3==0) { print '<tr>'; }
print '<td valign="top">';
include ('/home/love/public_html/hopelessromantics/mt/past/'.strrev($tok));
print '</td>';
if ($i%3==2) { print '</tr>'; }
$i++;
} while ($tok = strtok(','));
?>
</table>
Rebuild and view your calendar! Feel free to post questions, and I'll try my best to answer; or make Eric come and answer the harder ones!