« Women's History Month | Main | hayseed »

March 05, 2006

MT hack, recent comments

mtbookcover.jpg

Looking around the blogosphere, I was rather envious of those sites that displayed recent comments on their Home page. So I did something about it. I bought "Hacking Moveable Type" by Jay Allen, Brad Choate, Ben Hammersley, and Matthew Haughey. Should you decide to buy a copy, I must warn you that it is rather geekie and not for the faint hearted so be prepared to do a lot of head scratching. But the twenty-four hours of torment was worth it when I finally got the Recent Comments in the right side panel just the way I wanted it.

First I "created a new module template" under the module tab in the templates section of MT dashboard. I named it recent_comments.inc - catchy huh?

Then I typed that same name into the field where it says, "Link this template to a file". The text that you type in the screen goes into the database and MT creates a file in the MT directory on your server with the name you type in this field. It took me a while to understand this. It is explained in the book better than the installation instructions that come with MT.

Just as there are lots of ways to skin a cat, there are lots of ways to add recent comments. The authors of this book provided a lot of different examples. I experimented with them all, trying to figure out how they were different. That was the fun part. I settled on the version below.


mttext.jpg

Then all I had to do was put an include in the Main Index where I wanted the list to show up. The include line looks like this.


mttext.jpg

Your name for the file might be different. I chose recent_comments.inc

I did find one apparent mistake in the book. On page 20, there are two pieces of code at the bottom of the page. It is rather confusing because the second must be inserted into the first but one tag line is left out. The MTCommentEntry tag goes after the MTComments and of course there needs to be a matching closing tag.

I learned a great deal more than I did know about the inner workings of MT with this book and through trial and error. Maybe next time, I will try writing a plugin.

Posted by roadapples at March 5, 2006 08:56 AM

Update: I received an email form Ben Hammersley. He gave me a more elegant way to do this. Thanks Ben.

Posted by: road apples [TypeKey Profile Page] at March 5, 2006 05:37 PM

Books on blogging! Do you move away from the computer to read them or do you put them just in front of the keyboard so that you can keep on with the real business??

Posted by: Tjilpi at March 6, 2006 03:30 AM

T: When the wife takes over my computer to do some of her work, I read about blogging. It happens sometimes.

Posted by: road apples [TypeKey Profile Page] at March 6, 2006 05:40 AM

i find a semi-circle of chairs, to supplement the floor space, works well.

Posted by: kim [TypeKey Profile Page] at March 6, 2006 10:37 AM

Well ain't you something!

Posted by: poopie at March 9, 2006 12:12 PM