November Echo Romeo Delta
a blog by Will Kemp

  • Recent Posts
    • Web Directions South 2009
    • Fedora 11 on a Samsung N140
    • WordPress Plugin Dependency Checking
    • Nokia 5800 Touch Screen Smartphone
    • Moving From Drupal Back To WordPress
    • Making A WordPress Theme
    • Object Oriented PHP With CodeIgniter
    • Optimising Ajax Search Suggestions
    • Passing Variables From PHP To Javascript
    • Ajax Search Suggestions Dropdown List
    • Subversion Hell
    • Converting From WordPress To Drupal
    • Moving A Wordress Site To A New Server
    • Shrinking VirtualBox VDI Files
    • Dynamic XML Sitemap Using PHP
    • Older Posts
  • Other
    • About Me
    • Contact
  • Misc
    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org

Converting From WordPress To Drupal

January 9, 2009 – 10:21 am

I decided recently that it was time to check out Drupal. Up to now i’ve been using WordPress for web sites that need a drop-in content management system, but Drupal seems to be fairly widely used, so i thought i should learn how to use it. As part of the learning process, i decided to convert this blog from WordPress to Drupal.

This blog was the obvious choice for the change, as there aren’t many posts or comments and it’s a geek blog so a bit of experimentation shouldn’t put visitors off too much. I did consider writing a php script to suck the data out of the existing mysql database tables and insert it into a new database in the format that Drupal uses – and i probably should have done, really, as it could have been useful in future – but i decided it wasn’t worth the effort as doing it manually wasn’t going to be that hard. There is a Drupal module for importing from WordPress, but it doesn’t work with the current version of Drupal yet.

There are two main aspects of converting a site from one content management system (CMS) to another – the appearance and the data. The first thing i did was to convert the WordPress theme i was using to a theme that would work with Drupal.

Converting the html to a Drupal theme was quite easy. It was mainly just a question of replacing WordPress php variables with Drupal ones (or, for the non-php literate: replacing WordPress tags with Drupal ones). Both CMSs have a similar approach to inserting data from the CMS into the page layout – at least they do if you use the “PHP template” theme engine (Drupal offers a choice of three different theme engines). I used the “Zen” theme as a reference for the variable names.

But converting the CSS was a bit more difficult. The page template CSS was simple, of course, as i had it all there in front of me, but finding out what CSS classes and ids the embedded modules used in their html required a bit of work. I could have read the source code, of course, but an easier way was to use the Web Developer plugin for Firefox. This plugin allows you to outline elements on a page by hovering the mouse over them – and it shows the CSS structure in an information bar at the top of the browser. So, by hovering the mouse over, say, the blog posts list at the top of the right hand sidebar, i could see the class structure of that element and write a CSS rule accordingly.

Getting the functionality that i’d had in WordPress was a bit more of a challenge though. A lot of the built-in functions that i’d got used to with WordPress aren’t built into Drupal. To get a properly functioning blog, i had to download and install quite a few modules. I even had to install a couple of modules just to include an image in a post.

In WordPress, the ability to configure how the URLs are structured is built in and simple to use – in Drupal, you have to install a module. To make the comments form sane enough for my liking, i had to install a custom module (courtesy of francort in the Drupal forum).

WordPress has a very good ajax wysiwyg editor built in, but Drupal only has a very basic text editor. I don’t mind using it myself, but it’s not something i could provide to a client for content management. I tried installing TinyMCE, which is a javascript wysiwyg editor – mainly because it allegedly had the ability to work with images too, but i couldn’t get that aspect of it to work. I wasn’t even slightly impressed by TinyMCE, i’m afraid – it simply didn’t work properly and it mangled the post i tried using it on. So i uninstalled it again. I haven’t checked to see if there are any other options, but i’ll get round to that at some point.

To transfer the content from the WordPress system to Drupal, i just created new posts and selected and pasted the text from the old ones. That was easy as there aren’t many posts in this blog yet. I set the creation time of each post to what it had been originally under WordPress – that bit was easy. There are only four comments so far and i copied those by viewing the posts they’re attached to (anonymously) using a different browser from the one i was logged in with, and used the same details as the original comments. Then in the admin interface i edited them and changed the date and time of posting to match the originals.

And then i was pretty much ready to change over. But at this point, i very nearly decided to stay with WordPress and not do the changeover. I wasn’t very impressed with Drupal and i could see it wasn’t going to be as good as WordPress. Drupal looks a lot more glossy and slick than WordPress does – but underneath the gloss it’s not as good.

In fact, this process made me realise just how good WordPress is – something which i probably hadn’t given it full credit for up until now. I knew it would make my life easier if i stayed with WordPress for this blog. But then, if i’d wanted an easy life i wouldn’t have decided to make the change in the first place. I need to get to know Drupal and the best way to do that is to run the blog with it, so in the end i carried on and did the changeover.

Changing over from WordPress to Drupal brought its own annoyance, of course. With WordPress, it’s trivial to have the WordPress installation in its own subdirectory, below the root directory of the web site. This is much tidier than just chucking all the WordPress files and directories into the site root. Apart from anything else, there are other files in the root directory that aren’t related to the WordPress installation and it makes life easier if you don’t mix them up. But where keeping files out of the root directory is trivial with WordPress, it’s virtually impossible with Drupal – particuarly if you want tidy URLs as well. If you’re interested in this (long running) issue, you can read about it in this Drupal issues thread where one rather pig-headed contributor refuses to see that it’s a problem.

Overall, i’m glad i made the change – not because i like Drupal (i don’t particularly, but i guess i just need to get used to it), but because i’ve learnt a lot by doing it. I’m sure there will be situations where i’ll need or want to use Drupal for content management rather than WordPress and the more experience i can get with it the better. But, although i’m sure Drupal is better for some jobs than WordPress, i certainly wouldn’t recommend installing it for a single-user blog site – use WordPress for that!