Import pMachine Blog Posts Into TypePad

Ok, here’s a little bonus. I spent some time importing blog posts from pMachine into TypePad the other day. To import the posts into TypePad you can use the Movable type import format. This format is discussed here:

The issue I was continually up against was simple formatting issues. I spent way too long trying to get it just right. I finally did get it, and here’s the script I used to export pMachine blog posts to Typepad:

$html = “”; // if accessing through http use
otherwise keep blank
// also when doing the actual importing, it should go blank
@mysql_select_db($database) or die( “Unable to select database”);
$sql = mysql_query(“SELECT * FROM pm_weblog”);
while ($row = mysql_fetch_array($sql)) {
$posttime = $row[“t_stamp”];
$postbody = $row[“body”];
$postmore = $row[“more”];
// do your string cleaning here
// i had to replace [url= and [/url] with href
// i had to remove [url=, [/url], [u], [/u]
echo “AUTHOR: Author_Name” . $html . “\n”;
echo “TITLE: ” . $row[“title”] . $html . “\n”;
echo “STATUS: Publish” . $html . “\n”;
echo “ALLOW COMMENTS: 1” . $html . “\n”;
echo “CONVERT BREAKS: 0” . $html . “\n”;
echo “ALLOW PINGS: 1” . $html . “\n\n”;
echo “DATE: ” . date(‘m/d/Y g:i:s A’, $posttime) . $html . “\n”;
echo “—–” . $html . “\n”;
echo “BODY:\n” . $postbody . $html . “\n”;
echo “—–” . $html . “\n”;
echo “EXTENDED BODY:\n” . $postmore . $html . “\n”;
echo “—–” . $html . “\n”;
echo “——–” . $html . “\n”;

This can be used as a file and accessed through a Web page. I must note however, that this only exports pMachine posts and not the post comments. My client had nothing but spam for comments, so I elected just to skip over it.

When loading the pMachine export file, TypePad will ask if you’d like to publish the blog posts. Go ahead and say yes. This script should nicely create an export file of your pMachine blog posts in the Movabletype format so that you can make a smooth transition.

Post written by Ed Reckers

Founder and lead web development consultant at Red Bridge Internet : San Francisco WordPress Developers and Consultants.

Leave a Reply