scriptygoddess

04 Aug, 2002

Full Calendar in MT

Posted by: kristine In: MT hacks

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!

78 Responses to "Full Calendar in MT"

1 | gatorlog

July 24th, 2003 at 5:42 pm

Avatar

Hi. this part seems to be weird..
Do I have to change the path?

include ('/home/love/public_html/hopelessromantics/mt/past/'.strrev($tok));
print ";

2 | Donna

July 24th, 2003 at 6:16 pm

Avatar

Gatorlog, yes you do – this question was answered just above, by me. You need to out your own path information in for the script to work properly.

3 | gatorlog

July 25th, 2003 at 12:01 am

Avatar

Oh. Sorry. Never mind. Problem fixed right now. Thanks a lot.

4 | Sketchee

August 25th, 2003 at 5:57 pm

Avatar

Okay so I've temporarily gotten my calendar page setup as instructed but need a bit of advise before I finish formatting it. My archives are named by default to be named after the entry id. How do I make the links link to the proper page?

http://www.sketchee.com/calendar.php

5 | kristina

February 4th, 2004 at 4:39 pm

Avatar

The calendar tutorial link is broken–I'm just looking to create alternating checkerboard-style on my calendar. Any tips on a simple way to do that for a MT-minimalist?

6 | Hannah

April 18th, 2004 at 12:04 am

Avatar

So, should anything other than the code you posted for the Master Calendar Archives be in our Master Calendar Archives template?
You wrote "inside my formatting;" what did you mean by this?
I am just confused as to whether we need to code something else in the Master Calendar Archives and embed your above code into it, or if that is all that should appear in that particular template.

Thank you. Your work is tremendous. :)
Hannah

7 | Sketchee

May 31st, 2004 at 1:45 am

Avatar

I never did solve it! 😐

8 | kadyellebee

August 4th, 2002 at 3:35 pm

Avatar

calendar archives
Okay, and I finally put together the code I'm using for my Calendar archive over at scriptygoddess – feel free

9 | Neurotic Fishbowl

August 6th, 2002 at 10:21 pm

Avatar

Calendar Archives
Thanks to the ever-amazing Kristine's post at Scripty Goddess on how to display all your calendars in an archive template

10 | Cynthia Speaks

August 7th, 2002 at 8:09 pm

Avatar

Hopefully…
Well according to this website we may be alright. By sheer luck or Divine intervention, take your pick, I bought

11 | Simply Sara

August 7th, 2002 at 11:21 pm

Avatar

Calendar stuff
Oh those Scripty Goddess's have come up with something very cool, again! You can see the result of the above

12 | kadyellebee

October 26th, 2002 at 6:21 am

Avatar

mid night ramblings
Once again, dreams of work woke me up, so I figured my energy was better spent doing something entertaining instead

13 | ETC. Indulging my inner geek

November 3rd, 2002 at 7:50 pm

Avatar

Calendar Archives
I recently tried Kristine's Master Calendar Archives tutorial and I just love the results! I've only been blogging for about

14 | Stitching for Sanity

November 6th, 2002 at 10:19 am

Avatar

Still Can't Sleep
I'm still awake! This sucks! But I have another MT toy, a Calendar Based Archive! And its all thanks to

15 | Live in the Delirious Cool

December 6th, 2002 at 5:06 pm

Avatar

Crossing off the days…
My archives list is getting a little long-in-the tooth, and I'd like to find another way to package them. Just another step in my quest for a real whiz-bang blog.

16 | gym.blog

January 3rd, 2003 at 9:04 pm

Avatar

Carla, Tabitha, Jayme:
I've installed the MT Authors hack, so now everything gets all nice and sorted by author. This means that

17 | Sillybean

January 20th, 2003 at 9:22 pm

Avatar

Various tricks with archive calendars
These tricks apply to the tiny calendars that appear on your home page, not the full-screen monthly archives from my

18 | Remarkably unpublished!

January 28th, 2003 at 9:05 am

Avatar

FAQ #4: What scripts and plug-ins do you use with Movable Type?
If it weren't for the generous people who share their code, this site would have long ago lost it's fizz. The related resources below list all the script sources I've used on this site at one time or another. Related resources: Next/prev category entry…

19 | 321Blog

February 5th, 2003 at 4:43 am

Avatar

MT Calendar
I found two tutorials that provide full-page calendar displays within MT. This one seems the simplest to create, using just

20 | Sillybean

March 9th, 2003 at 8:26 pm

Avatar

Various tricks with archive calendars
These tricks apply to the tiny calendars that appear on your home page, not the full-screen monthly archives from my last post How to link to a full day's entries instead of the last one on that day: – Turn…

21 | Live in the Delirious Cool

August 20th, 2003 at 2:35 pm

Avatar

Things left behind.
Oh, and no more WeatherPixie.

22 | Kit-Kat's Chit-Chat

September 11th, 2003 at 3:21 pm

Avatar

Can you believe how much I'm posting lately?!
LOL. It is so unlike me. The blog bug must have came to visit me again. I added a few new things yesterday – in addition to my layout design. Notify You and Full Archives. Notify You allows you to…

23 | no fixed position / weblog

September 27th, 2003 at 2:48 pm

Avatar

Master To-Do List
To be finished before launch:   FIRST PRIORITY: finalize archiving names/paths of archive files implement calendar-based master archive implement calendar include for the blog index and monthly archives clean up/structure CSS files customized sear…

24 | Electrosketch!

December 28th, 2003 at 12:09 pm

Avatar

What code resources do you use?
The JavaScript Source is a great place to find javascript resources and Scripty Goddess is a goldmine of PHP and other scripts tailored for the movable type environment. Also, another good source for tips is Girlie Matters. You may also want to check o…

25 | .::faithjean.com::.

January 8th, 2004 at 3:24 pm

Avatar

20 things on My 2 Do list
1. Add smilies in the 2. | Category | 3. Counting for (x) Recent entries 4. Statistics: " x entries", "x comments", "x users online", "x on this page" script 5. Last 50 referrers 6. 10 most commented entriescomments 7….

26 | .::faithjean.com::.

January 8th, 2004 at 3:28 pm

Avatar

20 things on My 2 Do list
1. Add smilies in the comments 2. | Category | 3. Counting for (x) Recent entries 4. Statistics: " x entries", "x comments", "x users online", "x on this page" script 5. Last 50 referrers 6. 10 most commented entries7….

27 | Eli

July 24th, 2004 at 12:31 am

Avatar

I have it working. I was wondering what the additional code would be if I wanted to have each month surrounded by an equally sized box (I noticed that some calender months stretch lower than others) and if I wanted to add a lil space between calenders horizontally.

Is it possible to have a box also around the days that have entries?

Anyhow, good work with the calender page. :)

28 | Tutorials

November 26th, 2004 at 11:50 am

Avatar

Calendar: Full Calendar
scriptygoddess…

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements