The Missing Pieces
I am getting close to being ready to roll with my department's blog. I am going to be using it for two purposes: announcements of news items, and tracking of upcoming events. For this purpose, I've set up two major categories: Headlines and Events.
The templates I've built are fairly simple, but I've had to overcome a lot of obstacles to get them to where they are now. I'm using the Case templates, and I want to have a sidebar (snav) with three or four items in it. The first two will be the Headlines and Events links which will expand on clicking to show all of the subcategories, and their subcategories as necessary. The remainder of the snav will be static links to other pages.
General Approach:
I am using and abusing the Category Archives feature of Movable Type for this endeavor. The index templates only generate a single page per template, and I want to have a hierarchical structure for my posts. Clicking into Events will show you ALL of the Events entries. Clicking on a subcategory will show you entries from that category and its descendants. Clicking on one of the sub-sub-categories will show you ITS entries plus those of ITS descendants (if any). This way you can drill down to see the level of detail you want by drilling down into the directory structure. As you go deeper you see fewer but more specific lists of entries. Category Archives let you have this kind of nested structure by building a generic template that will recursively produce an output page for every category and its subcategories and their subcategories... By playing with the file path variables, I can lay out a directory structure that matches the hierarchy of the nested subcategories.
In order to make the navbar behave properly (expand and collapse and highlight the current item) I've had to jump through a lot of hoops and it still doesn't work the way it should. I even experimented with having MT build a custom stylesheet to supplement my Case Navbarfix stylesheet on the fly, and that works to some extent.
The concept behind a Movable Type events calendar is actually fairly easy to pull off in an index template. You just set sort_order="ascend" and days="1", and then it will only show the current day plus all days forward of the current day. Remember that you can define blog items that occur in the future!
At this point I've identified most of the problems I'm still facing, but I'm running into walls looking for ways to overcome them.
Problems I've run into so far:
- As mentioned above, I can't use a category named either "Announcements" or "News" and have the posts get selected properly by either MTIfIsDescendant or MTEntriesWithSubCategories in the Category Archive context. It works fine in the index context. Most other names work just fine without any recoding, so I've settled on "Headlines" since it's close to what I want and it works.
- The the Category Archive context, MTEntriesWithSubCategories breaks when I specify days="1" and ends up displaying stuff from all over the place. I know that this is because archives are supposed to display ALL posts, but I want to override this behavior. If I don't specify days, then my category pages get filled up with the correct content, but they also include past events which more or less invalidates the whole idea behind an upcoming events calendar. I can limit the list by lastn, but not by days - what's up with that?
- In the Category Archive context, you can't output the MTCategoryID or run tests to determine if the current category in a list of all categories is the same as the current category of the Category Archive output file. This ability would make building the navbar almost trivial. Sooooo much headache averted... There is a plugin called MTCategoryOfArchive that addresses this issue, but it is not currently installed on blog.case.
- There is no good way to limit display of future events to a finite number (like the next 5 events). If you specify lastn="x" then is will display that many from the END, meaning the farthest out into the future. There are a variety of hacks and plugins that can each address this in some partial manner, but I haven't yet figured out which combination of the dozens is best. A lot require PHP or SQL calls.
- Future events seem to stick themselves at the top of the feed for planet.case.edu, so the sorting order could get weird for some clients. I haven't dug into this issue at all yet.
Once this is all sorted out, I will have a fearsomely awesome events calendar! RSS feeds and calendar files for iCal and Outlook for each category, and any number of other fun bells and whistles.

Comments