Daily Dish of Dominey Design
{  April 5, 2002  }

Library How-Do

Update (11.09.02): The instructions in this post are no longer valid. The library has been redesigned to incorporate MTAmazon as part of the CMS.

Several MovableType users have asked how the revamped library works behind the scenes, so I decided to sit down and hammer out a walk-through for all you MT developers. Do note that most of this may be above the heads of some MT users, and I simply don't have the time to teach if you can't pick up the jargon. If however you have a pretty good knowledge of MT, and a little HTML savvy, you should pick up what I'm doing. Here are the nuts and bolts.

The library is a blog unto itself - completely separate from the page you are reading now. The blog is contained in the library (whatdoiknow.org/library) directory, apart from all the other content. Within Library are four categories - Feature, Recent, Archived, and Reading. Unless I alter the layout of the page, there will always be one item categorized as a Feature, three newer ones as Recent, and the rest fall under Archived. As for the Reading category, that controls the content for the column you see on the left side of this screen.

With my library entries categorized, I then set about publishing them on one page. This was done through three sets of <MTEntries> tags modified to include specific categories. The Recent section looks like this:

<MTEntries category="Recent" lastn="3"></MTEntries>

Essentially this instructs MT to publish only the 3 newest entries in the Recent category. The Feature tag looks the same, except it only retrieves one entry - lastn="1". The Archived section is split in two for two columns. One looks like this - <MTEntries category="Archived" lastn="3"> - the other - <MTEntries category="Archived" lastn="3" offset="3">. The first Archived tag retrieves the 3 most recent entries categorized as Archived. The second tag retrieves the next 3 entries by offsetting the count for items 4-6. That's about it for the main template.

The Reading category is a little different. I created a basic template, in addition to the index page described above, that only includes the last 3 entries under Reading (<MTEntries category="Reading" lastn="3">). This file is then included in the main index page of this site (the one you're reading now) through SSI (Server Side Includes).

So what happens when I receive a new book? I create a new entry, categorize it as Reading, and add the book's title and hyperlink. This places the book info in the Reading box on your left. Then when I have a review written and I'm ready to publish, I change the entry's category to Feature, the previous Feature to Recent, and the third to last Recent item to Archived. This can all be done in a couple of seconds in MT's power-editing mode. Screenshot (author fields removed for security).

Rebuild, and everything shifts down a spot.

That's the basic idea. There is however an additional step that really kicks in the power. Inside each one of the template's sets (with the exception of the Reading category), there are additional SSIs that use the entry's ID as a variable for including thumbnails of the cover, subheads, etc. The thumbnail include looks like this:

<!--#include virtual="includes/<$MTEntryID pad="1"$>.thumb.tmpl" -->

Essentially this takes the ID of the entry, as assigned by MT, and uses it as a variable for retrieving my thumbnail document. The thumbnail document is just a simple doc with an <img> tag for that particular graphic. I use the same style of SSI for the larger covers you see as well.

So that's the scoop. I'm basically employing MT categories as a way to easily organize and distribute content.

Comments

So the reading section on the home page is actually part of the Library blog? And then once you've finished a book you add the review to that same entry? Very nice. Thanks for the walkthough.

Posted by: Ryan at April 5, 2002 8:54 AM

That's right Ryan.

Posted by: Todd at April 5, 2002 9:25 AM

Thanks for putting that up, Todd. When I finally migrate to MT, I'm going to try it...

Posted by: James at April 5, 2002 10:35 AM

Excellent! Thanks!

Posted by: Geoff at April 5, 2002 10:35 AM

Much appreciated. I was wondering how things moved from one group to another and I thought you might have had that automated somehow, but the power-edit function does make the manual change quite easy. It's great.

Posted by: Matt at April 5, 2002 1:00 PM

After thinking about it I realized you wouldn't need to use catagories to have a similar layout


...


...


...

should work if you're not into catogories or want to use them for something else.

Posted by: Ryan at April 5, 2002 4:47 PM

Oops! html striped, let's try this


...


...


...

Posted by: Ryan at April 5, 2002 4:50 PM

I thought about that too Ryan, but then how do you control the different levels of information for each section?

Posted by: Matt at April 5, 2002 5:06 PM

Well we've got the title, Main Entry Text, Additional Entry Text, and Excerpt to fill up. I assume that's how Todd's handling things now.

Posted by: Ryan at April 5, 2002 5:50 PM

I wonder if you could automate this, or other content management, using MT's setVar and getVar tags.

Posted by: Andrew at April 8, 2002 6:41 AM

Good article... but it was fine if anyone make a learning cd-rom as a visual reference guide to implement all the process, since the download of the package to the add entries process. No that it is very hard, only for genius, kinda of stuff, but i - and many other people, i think- donĄt have time to read all the manual. I would pay for it... really! Not a trillion bucks, but at a decent price.
Maybe i should made a sugestion to Mena and Ben?!

Best regards to all,
Bruno

Posted by: Bruno at April 11, 2002 9:48 AM

archives

You are reading "Library How-Do" in the individual archives.

Check out other recent posts in the Site News category

Return to the front page.