2009-10-18

Creating Drupal themes from scratch

If you want to create Drupal themes from scratch, i.e. you do not want to modify an existing theme but rather paste your own html and insert placeholders, MODx style, then this post is for you.

MODx has long been my favourite framework because of it's simple and powerful templating system (copy and paste your html, insert placeholders, go), but recently the lack of visible activity has convinced me to look for other alternatives. I bought "Using Drupal" and "Joomla! A User's Guide: Building a Successful Joomla! Powered Website". One of the reasons I never started to use Joomla! was that it always seemed like it would force me to organize content into two levels. After reading a few pages of the book I found out that it was in fact true. So I put the Joomla! book down and started reading "Using Drupal".

Drupal seems a lot more flexible. The thing that has always scared me away from Drupal and back to MODx is templating. Here is an example: http://drupal.org/node/11774 The templating system is very flexible, -and may seem very complicated.

In addition to this, the ultimate beginners theme, Zen, actually complicates things further if you, for instance, would like to move an existing site to Drupal, or if you want to unpack the html from the designer, insert your placeholders and test it. At least that's my conclusion so far.

Here's a simplified version of my current workflow: 
  • Use a standard theme for your admin pages:
    • Adjust settings under http://<yourservername>/admin/settings/admin
  • Download an empty theme. The best I've found so far is foundation
  • Unzip and paste into themes folder.
  • Rename page.tpl.php in the empty theme to something else.
  • Paste your html to a new file called page.tpl.php.
  • Using the old page.tpl.php as reference, insert similar placeholders into the new one.
  • Enable and test.

1 comment: