Several months ago I needed to export a blog from Serendipity to WordPress. WordPress has an RSS import that works fairly well, only the images required a little extra work. Yesterday, a former customer asked about exporting their blog content to whatever their new host is using. It turned out to be Movable Type. It also turned out that this company didn't know how to import data into MT.
I Googled for "import to movable type" and immediately got back the results that you can see if you do the same. The MT manual page and data format schema are the first two results.
MT uses a text delimited format for imports, for some reason not caring that most blog software can export to RSS 2.0. Why make it easy if they're leaving us, eh? Because you should care about things like this, that's why.
It took about 15 minutes to write a (bad) php script that would spit out the contents of the blog, which is after all a mysql table like most. Once I did that, a global replace for image URLs would fix most of those. Here's the basic idea (after the connect):
// First the query, which will obviously vary depending on what the source is
$sql="SELECT title,author,timestamp,body,extended FROM serendipity_entries";
$result = mysql_query($sql,$db);
while( $row = mysql_fetch_array($result) ) {
echo "TITLE: " .$row['title'] . "\n";
echo "AUTHOR: ".$row['author']. "\n";
echo "DATE: " .date("m-d-Y h:i A", $row['timestamp']) . "\n";
echo "PRIMARY CATEGORY: $primary_category\n";
echo "CATEGORY: $category\n";
echo "-----\n";
echo "BODY:\n";
echo $row['body'];
echo "-----\n";
etc.
Thursday, January 22. 2009
Movable Type Import
Trackbacks
Trackback specific URI for this entry
No Trackbacks

