antanova

MOVED: My blog is now at http://antanova.com/blog

Moving from Blogger to hosted Wordpress

I’m moving my blog from Blogger to my own site, using Wordpress. During the move, both my Blogger blog and this one will look pretty average, because I’ll be using basic themes for both. When I’ve settled in to this new Wordpressiness, I’ll theme it up and I’m planning to use Wordpress to drive my whole site.

One problem I have had already was in importing my Blogger posts and comments to this site. Wordpress comes with an “import” function that supposedly imports from a lot of different blogging engines and CMSes, but I found that it didn’t work for me.

What I tried to do was import directly from my Blogger account, but Wordpress kept getting stuck showing one post and one comment imported, although those posts never actually made it to Wordpress. So, after reading a couple of posts on the Wordpress support forums, I signed up for a Wordpress.com account. Then, using the import tool on that account, I successfully imported everything from Blogger. With me so far?

Next, I used the “export” tool from that Wordpress account, exporting a Wordpress XML file with everything in it. It was this I tried to import to my this site. I say “tried”, because that didn’t work either. There was a problem with the permissions on my server forbidding Wordpress from creating the folder where the XML file would be stored.

A bit of Googling later, and I saw that this is a known WP bug. The temporary fix was to CHMOD the uploads folder to 777 - meaning that anyone has read, write and execute permissions in that folder. Right, so that done, at last I successfully imported all my posts and comments, not forgetting to reset the permissions on the upload folder.

And here we are.

Labels: ,

Jason posted this on Sunday, November 16, 2008 at 2:29 pm.
Read comments (66). Leave comment.

Blogmarks button Digg button furl button magnolia button Google Bookmarks button StumbleUpon button Yahoo MyWeb button

Code bits: PHP date year box script

Creating a warranty registration form for the proud owners of a new LCD panel should have been a very straightforward job. Well, actually it was, but that sort of interrupts the flow of this post a bit, so I’ll skim over that inconvenient fact.

For the ‘date of purchase’ field, I simply added the day and months items as <select> form controls. Then I got to the ‘year’ box, and realised that soon we’ll be leaving 2008 behind like a piece of temporal rubbish, and embracing the glistening newborn that will be 2009. I know the client wouldn’t really appreciate having to come back to me a month after his site goes live just so I can add a new year to the form, so I decided on the only sensible course of action a quality web designer like me could take, and made a super-simple php script to write the year into the form.

Here’s the php function:

function writePurchaseYear()
{
    $currentDate = getDate();
    $currentYear = $currentDate['year'];
    $startYear = 2008;
    $output = "<option value=\"2008\">2008</option>\n";

    if($currentYear - $startYear > 0)
    {
        for($i = $currentYear; $i >= $startYear; $i--)
        {
            $output = $output . "<output value=\"$i\">$i</option>\n";
        }
    }
    echo $output;
}

So, put that somewhere on the page that’s going to use it, and then, where you need the actual form control to be on the page, you need to put:

<select name="purchaseyear" id="purchaseyear">
    <option selected>----</option>
    <?php writePurchaseYear();?>             
</select>

So there you have it. HTH, and all that.

Labels: ,

Jason posted this on Thursday, November 13, 2008 at 3:44 pm.
Read comments (1). Leave comment.

Blogmarks button Digg button furl button magnolia button Google Bookmarks button StumbleUpon button Yahoo MyWeb button