More Movable Type Fun
Dec 20th, 2005 by Karen
Well this week started the blogging pilot project at University Houston Libraries. So far we have two internal blogs and two external blogs that are up and running. Probably the biggest challenge with the process was knowing so little Perl that it was difficult to do anything useful with Movable Type’s Perl API. That hasn’t stopped us from finding ways to customize how our bloggers interact with system though. One of the biggest things I did was installing a bunch of plugins to help make things a bit easier to use both for the bloggers and the system administrators (ie me and my staff). Here is a list of what I installed.
- Enhanced Entry Editing
- ConfigureUI
- Workflow
- BigTemplateWindow
- QuickImagePost
- Custom Fields
- Better File Uploader
- MTSpeling
- CheckLinks
Additionally I’ve been incorporating a lot of PHP code into my templates. My favorite trick thus far has been pulling all the authors and their information for a given blog and displaying it on the screen. There is a plugin that will help you do this is you pubish your pages statically, but if you publish dynamically you will have to do this with PHP. Below is the code I came up with. The only problem with it is that I haven’t figure out how to properly sort authors by their last name. Right now they look like they are sorting properly because I’ve got them sorted by username (lastnamefirstinitial), but they really aren’t sort by their last name per se. I need to learn so more PHP to do the proper string manipulation to break out the first and last names.
<?php
global $mt, $db;
$db = $mt->db();
$blogID = $this->tag('MTBlogID');
$authors = $db->get_results("select author_email, author_nickname, author_name from mt_permission p inner join mt_author a on a.author_id = p.permission_author_id where p.permission_blog_id =$blogID order by author_name");
foreach ( $authors as $author )
{
// Access data using object syntax
echo "<li><a href=\"mailto:$author->author_email\">$author->author_nickname";
echo "</a></li>\n";
}
?>
</ul>
This code doesn’t use the traditional PHP/MySQL code but rather EZSQL which comes installed with Movable Type. It make the process a lot easier particularly since you don’t have code for the connection (the traditional way contains username and password info) to the MySQL database that has the Movable Type data. By using EZSQL you are using connecting to the database using the database in your mt-config file. While EZSQL makes the process easier, you still have to know SQL to get what you want out of the database.
I’ve also been working on creating a contact form that will allow people to submit information to the site and trying to get my templates with PHP to work properly with the pages that are CGI. It looks like I’ll be completely taking apart the comment form and search page. I can’t get them to look right and have the PHP code I want. Working on this, I keep wishing that I had greater confidence in the multi-blog version of Wordpress, but from what I can tell it just isn’t ready for primetime yet. So I’ll make my Movable Type modifications and post the code in the hopes it will help others.

