mt courseware update

| 10 Comments | 1 TrackBack

I'm chugging along on the MT as courseware project. It's forcing me to brush off my rusty SQL skills, learn more about MT plugins, and really think about organization of information. All good things.

I struggled for a while with the calendars, because I wanted them to link not to a specific entry (which is the default in the provided templates), but rather to a daily archive. That way all important entries for a given day--due dates, class topics/readings, in-class exercises--would be displayed together on that date. I finally found the solution on Sillybean's blog, in a post entitled "Various tricks with archive calendars" (caution to Safari users; I have to reload the pages on that blog several times in Safari to get the right style sheet. not sure why).

My next problem with the calendar was that there's no way to limit a calendar to a group of categories--you can have it find entries in one category, or in all categories, but that's it. I wanted the calendar dates to be linked to an archive if anything in the due dates, class topics, class readings, or in-class assignments showed up on that day. The solution I ended up with here was to create an "extra" category of "calendar," and assign that as a secondary category to anything that fell into the above categories. Kind of a kudge, but it works.

The main page of the course site is now showing only current entries with categories of "news," "due dates," "in-class exercises," or "discussion questions"--the things I want students to see first when they go to the site. This was accomplished using Brad Choate's MTSQL plug-in, and this SQL query:

SELECT DISTINCT entry_id FROM mt_placement right join mt_entry ON mt_placement.placement_entry_id = mt_entry.entry_id WHERE entry_created_on <= NOW() AND TO_DAYS(NOW()) - TO_DAYS(entry_created_on) <= 10 AND entry_blog_id = 9 AND (placement_category_id = 64 OR placement_category_id = 65 OR placement_category_id = 61 OR placement_category_id = 50) ORDER BY entry_created_on DESC

What this does is look for all entries from this course blog that have been assigned any of those categories (the blog ID and category IDs would vary based on your implementation, of course), limiting it to entries published in the past ten days, excluding post-dated entries. Duplicate entries (for example, something that somehow shows up in both "news" and "discussion questions") are removed with the DISTINCT modifier. Don't ask how long it took me to write that, or how much time I didn't spend with my family while I puzzled it out.

Update, 8/5
An alternative to the SQL approach would be to use PHP to hide post-dated entries. This approach is described by Sillybean in the Using Movable Type as an events calendar entry. Basically, you would use an MTEntries tag to limit to the desired categories, then use PHP to hide an entry based on some date calculations. MT would be generating a big page each time, but most of it would be stripped out by the PHP code.

I've also created a syllabus category, and a separate syllabus page. That template lists items in ascending rather than descending order, and strips out all of the date and related posting information.

I've not yet worked on the individual entry pages, but I plan on using the same basic template as I've got on the main and syllabus pages. I may use an include for the sidebar material. The advantages of an include would be not having to modify three different index templates when I change it, and less load on MT in terms of generating index pages with complex calendars. The disadvantage is that pages will load more slowly (as they do with this blog, which uses includes for the banner and sidebar). May try some usability testing this summer to see how much the lag time in loading with includes bothers my target audience.

I'm having to give a lot of thought to the categories to use. Right now I have topical categories for each of the main areas we cover in the class, as well as structural catgories (like syllabus, due dates, in-class exercises, etc). Once I've settled on categories, I'll build some hand-coded archive menus to allow students to see all the posts on a specific topic. (If I have the archive menus auto-generated, it will mix the topical and structural categories, which would be confusing.) The topical archives will point to archive pages that have a standard date/title heading format with comments and trackbacks enabled. The structural pages, like the syllabus, will vary in their layout and presentation based on the content being presented (some will be ascending date order, some descending, some with comments and trackbacks, some without, etc).

This won't be a "plug and play" solution when it's done--anyone who wants to use it will have to a) add in their own categories, b) figure out the id #s for blog and categories for the sql query on the main page, and c) install the MTSQL plug-in as well as d) changing content, look and feel, etc for their course. But I will provide all of my templates when I'm done, which should save you a good bit of the work.


1 TrackBack

TypePad and MT for learning sites from // hit those keys / worklog on August 19, 2003 4:00 PM

I don't know if the estimable Liz Lawley has noticed my IP tracks all over her MT design for a class, but I've been trying to learn from a master how to go about setting up the different pages and Read More


What do you mean when you say "include"? An MT template module, SSI, PHP include, or something else?

I'm trying to get straight in my own fuzzy head where the performance hit is, is all.

Sorry. PHP include.

The performance hit on MT is in the rebuild process. Generating the archive calendars is very computing-intensive, so when I rebuild my archives (as compulsive template-tweakers like myself are wont to do), it will be slower and more demanding on the server if every single page has its own archive calendars to be created.

If I put the calendar code in a separate file and do an include, MT only has to generate the calendars once, rather than dozens of times. But then the pages slow down a bit because the PHP include tends to have a bit of a lag time. It shouldn't be a big deal, but I find it annoying. And if you have to load a bunch of pages in a row, it becomes more annoying.

Hmmmm. Is there a way to have MT include the file? That would solve it...have MT generate the code as some kind of module, then include it in the pages as they're being built? Is that possible?

Off to do some research...

Well, MT does have template modules, but depending on the implementation they may be just as slow as PHP.

I dunno, in other words. :) Tell the rest of us what you find out, won't you?

Liz, you can use the MTInclude tag to include an MT Template Module. And, like an index template, a Template Module can be linked to an external file so that you can use your favorite editor to maintain it. The file gets "included" at rebuild time so there's no performance hit at user-request-by-browser time.

Hope this helps.

Bob, that helps a lot. Thanks. As long as I rebuild the include page before I rebuild the other pages, that ought to work really well. Will try it now.

Just a test, to see if sidebar updates properly...

Ah. Just realized the problem with using MTInclude. It will work fine for the main page, and for any entry that's been recently added or commented on. But older archive pages won't be rebuilt when new comments, archives, etc are added--their sidebar will be static content.

So I think I'm back to the PHP include approach. Turns out it may not be what's slowing down pageload, may just be the amount of stuff being processed in the sidebar, and the fact that it's the last div on the page.

The modules are cool, though. :)

You should be able to shorten your sql statement and make it a little more readable by using the IN clause when you limit the results by the "placement_category_id". Change it to: select distinct.... AND placement_category_id IN (64,65,62,50).

The research I've done seems to conclude that with MySql, there is no performance difference between using IN vs OR. In some other RDBMS's, there is a difference. Either way, I think its much easier to read, especially if you have a lot of categories that you want on the main page.

Excellent. Thanks, Jon.

(And as a side note, how cool is it to have a former student come back and help me with some code via my blog? A wonderful example of the power of this medium...)




Recent Photos
This is a Flickr badge showing public photos and videos from mamamusings. Make your own badge here.

Upcoming Travel

Creative Commons License
This blog is licensed under a Creative Commons License.

About this Entry

This page contains a single entry by Liz Lawley published on August 6, 2003 10:24 AM.

duplicate pings from radio weblogs was the previous entry in this blog.

what a friend we have in jesus is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.