Individual Entry

 
 

 
Making life easier

Web

Often, I have a deep fear of upgrading software, whether it be my operating system or the publishing platform I use to maintain my web site. From bitter experience, I’ve learned that, if there’s a way of something going wrong, it will. In the case of Movable Type, I’ve had to relearn a lot of what I thought I knew about the platform in the process of switching versions from 3.x to 4.x as I design my new site. (The hours I put in yesterday trying to get the comments function to work would be a case in point.) Today, however, I finally got to try out one of the main reasons I decided to switch to the new edition: custom fields.

Arvind Satyanarayan originally created the Custom Fields plugin for version 3.x of Movable Type, which was then acquired by developer SixApart and fully integrated into the professional edition of Movable Type 4.x. By default, Movable Type only has a limited number of available fields for each post - e.g. title, date, entry body, extended entry, post time. These are generally sufficient if you just want to blog about your pet cat, but if like me you’re doing something slightly different, such as maintaining a DVD database, this sort of thing is woefully inadequate. In the current iteration of the site, each DVD entry essentially consists of an entry body field which contains a massive block of text and code, providing both the data itself and the layout:

<table width=”100%” border=”0” cellspacing=”0” cellpadding=”0” align=”center”> <tr> <td valign=”top”> <h2 class=”heading”>831</h2> <h3 class=”post-title”>Australia <br> <span class=”subhead”>Blu-ray <br> <img src=”http://whiggles.landofwhimsy.com/images/star_1.gif” alt=”*” width=”23” height=”22”><img src=”http://whiggles.landofwhimsy.com/images/star_1.gif” alt=”*” width=”23” height=”22”><img src=”http://whiggles.landofwhimsy.com/images/star_1.gif” alt=”*” width=”23” height=”22”><img src=”http://whiggles.landofwhimsy.com/images/star_1.gif” alt=”*” width=”23” height=”22”><img src=”http://whiggles.landofwhimsy.com/images/star_0.gif” alt=”0” width=”23” height=”22”> </span> </h3> <p>Review: <a href=”http://www.dvdtimes.co.uk/content/id/70644/australia.html”>DVD Times</a></p> <p><em>Region:</em> B (UK) <br> <em>Director:</em> Baz Luhrmann <br> <em>Label:</em> 20th Century Fox</p> <p class=”small”><em>Added Wednesday April 29th, 2009</em></p> </td> <td width=”10”><p>&nbsp;</p></td> <td width=”120” valign=”top”> <a href=”http://www.dvdtimes.co.uk/content/id/70644/australia.html”><img src=”http://whiggles.landofwhimsy.com/images/bd-australia.jpg” alt=”BD” width=”116” height=”149” class=”left”></a> </td> </tr> </table>

That code is just for a single entry (the BD of Australia), which really amount to very little on screen at the end of the day. Now, imagine that code duplicated around 830 times for my entire collection. That’s just not efficient. Worse, though, it makes updating the collection to reflect a new site design an incredibly time-consuming process, because so much of the layout is hard-coded into each entry.

This is where the joy of Custom Fields comes in. Now, instead of coding the layout for each individual entry, I can simply create a master layout, give Movable Type the code telling it where to put the data for each field (corresponding to things like region code, director, cover art, rating out of 10, review link where applicable, and so on), and enter the data into the Movable Type database. Here’s the master layout code:

<mt:Entries> <div class=”blockcontainer”> <div class=”leftblock”> <mt:If tag=”EntryDataDvdcover”><img src=”http://www.landofwhimsy.com/images/dvd-<mt:EntryDataDvdcover>.jpg” alt=”DVD” width=”116” height=”165” class=”collection” /></mt:If> <mt:If tag=”EntryDataBdcover”><img src=”http://www.landofwhimsy.com/images/bd-<mt:EntryDataBdcover>.jpg” alt=”BD” width=”116” height=”149” class=”collection” /></mt:If> <mt:If tag=”EntryDataHddvdcover”><img src=”http://www.landofwhimsy.com/images/hd-<mt:EntryDataHddvdcover>.jpg” alt=”HD DVD” width=”116” height=”149” class=”collection” /></mt:If> <mt:If tag=”EntryDataCustomcover”><mt:EntryDataCustomcover></mt:If> <mt:If tag=”EntryDataRating”><br /> <img src=”http://www.landofwhimsy.com/images/stars<mt:EntryDataRating>.gif” width=”118” height=”36” alt=”” /></mt:If> </div> <div class=”rightblock”> <h4 class=”dvdtitle”><span class=”number”>#<mt:EntryDataNumber>.</span> <$mt:EntryTitle$> <img src=”http://www.landofwhimsy.com/images/format-<mt:EntryDataFormat>.gif” alt=”Format” width=”29” height=”8” /><span class=”dvddata”><br /><mt:EntryDataEdition></span></h4> <p><strong>Region:</strong> <mt:EntryDataRegion><br /><strong>Directed by:</strong> <mt:EntryDataDirector><br /><strong>Label:</strong> <mt:EntryDataLabel></p> <mt:If tag=”EntryDataContents”><mt:EntryDataContents></mt:If> <mt:If tag=”EntryDataAlttitle”><p class=”small”><strong>Original title:</strong> <mt:EntryDataAlttitle></p></mt:If> <mt:If tag=”EntryDataReviewlink”><p class=”small”>Read the review at <a href=”<mt:EntryDataReviewlink>”><mt:EntryDataReviewsite></a></p></mt:If> <mt:If tag=”EntryDataAdded”><p class=”small”><em>(Added <mt:EntryDataAdded>)</em></p></mt:If> </div> </div> </mt:Entries>

That’s it. Don’t worry about trying to understand the code above - the point is I entered that once and now simply add the required information into the database for each entry. “<mt:EntryDataDirector>”, for instance, tells Movable Type that I want to display the director associated with this entry, so it calls up that information from the database and places it automatically:

Custom fields

Hardly rocket science, but it’s streets ahead from what I was doing before. Of course, I do have to re-enter all my data, but that’s far more straightforward when you’re just copying text into the correct fields and letting the database worry about where to put it all. You can see the new system in action here (at the time of writing, I’ve entered the first 80 discs in my collection).

Now, if you’ll excuse me, I’ve got some serious button-mashing to do. In the meantime, here’s a picture of Hollywood’s finest thespian, Lindsay Lohan, to tide you over:

Lindsay Lohan

 
Posted: Monday, May 25, 2009 at 6:15 PM | Comments: 2
Categories: DVD | Technology | Web

 
Comments

1.

Nice isn't it =)
I've done a similar thing in wordpress with my list of videogames on my own blog.
http://blog.svalas.net/?page_id=99
But I'm currentrly working on my own backend in php for handling it all, both for my movies and games. (have a couple of thousand DVD's and hundreds of games for all the different formats...)
I like your navigation in the new layout... think I'll be stealing it for myself ;)

Posted by: Andreas Sval�s, May 27, 2009 1:54 PM

2.

By all means steal away. :)

I really like the design of your site, by the way. Beautifully laid out and highly functional.

Posted by: Michael Mackenzie, May 27, 2009 6:17 PM

Comments on this entry and all entries up to and including June 31st 2009 have been closed. The discussion continues on the new Land of Whimsy blog:

http://www.landofwhimsy.com

 

 
 
Back to...