The urge to be productive again made me look at the website I built four years ago and realize it’s a bit of a mess. It was a crude attempt at bridging a Movable Type install (which was written in PERL) and whatever I knew about PHP at the time to make something of a dynamic site. After being a paid web-monkey for about three years now I decided to finally take the plunge and re-do the site using the buzzword compliant Drupal (especially since I’ve been working with it for so long).
In rebuilding the site, I’ve decided to document the process (and my love/hate relationship with Drupal). So here’s how we get started:
It’s a fairly skimpy list of modules, but, being a masochist, I tend to write a bunch of custom modules because I need my content to do certain things, and (this might be a bit of a heresy to those who work with Drupal more than myself) I find the Views module too unwieldy for my liking. The most important modules to get running for my site, which really is an art portfolio, are Imagefield and Imagecache. Having had to write a few modules to handle image uploading/thumbnailing for Drupal (while CCK was unavailable for Drupal 6), I appreciate the awesomeness of these modules combined.
The first custom module that I added was a small one that I wrote I for another site with the specific goal of making a single-user blog. (How can I document, if there’s no content type to document with?) It consists of a content type for a blog post, a few menu callbacks, a couple of blocks, and a small admin module for adding other content types to the blog. The main features are a menu callback that provides an archival listing of blog posts using the format yyyy/month and an “archives” block showing the year and list of months showing how many posts were made during that period, e.g. Blogger. (And, yes, this probably could have been done with CCK and Views, but I really haven’t been able to get into that module.)
As far as the base theme, I’ve come to like the Blueprint framework quite a bit. The typography is sensible, and the built in “span” classes make designing a breeze. In any case, back to setting things up….
After some tinkering with some Taxonomy and Pathauto settings, I create a new content type using the CCK-lite in Drupal core. I like to keep my sketches and random images that I post on my blog separate from my “portfolio” images, and I do think of them as a separate type of content, so I call this one “Blog Image”. I add an image field to that, add it to my “allowed types” for my blog, and that’s pretty much that. (Examples will be coming, but I just want to get everything in place before I start making “real” content.)
Drupal’s node module is notorious for being…well, not the being most beautiful front page you can have. I tend to use a mini-module called “index” which just adds a menu callback called “index” since, to me, it seems a lot more “webby” and familiar than “node”. It’s a skeleton of sorts; if I need to create custom blocks for the front page, I will add them to this, otherwise it does absolutely nothing except for the name. I add this code to page.tpl.php in my theme to make my front page:
<?php if ($is_front): ?><?php endif; ?><?php print $index_splash; ?><?php print $index_first; ?><?php print $index_second; ?>
In this case I’m planning a large central splash image and two smaller areas beneath that. I’m not sure what would go in those two regions, but I’m adding them there as placeholders for now. I’ll then add a few regions to my template.info file, and populate the front page with blocks in those regions, setting the selected blocks to only show on “front”.
Now that I’ve finally gotten rid of the default Drupal page, I can concentrate on making this site what it’s intended to be: a portfolio site. The first thing I do is create another content type: “Portfolio Image”. Like the “Blog Image” it’s a simple content type with title, body, and an attached Imagefield. Unlike blog images, however, I do not want comments enabled on these. Showing portfolio images with comments to potential clients seems akin to turning in a term paper with sticky notes and sharpie pen scribbles written by your friends (and random homeless people) saying things like “Dood, this is t3h roXor!” or “Damn. You suck! Epic fail!”; it just does not seem professional.
I’m not quite sure how I want to organize the images yet. I have a couple of options that I am considering: use Drupal’s Book module since it allows for easy re-ordering of “pages”, has built-in “next/prev” type navigation, and I wouldn’t have to write a lick of code, or suck it up and write my own “gallery” module to organize things. (I’ve looked over the gallery modules at drupal.org, and none of them really tickle my fancy.) I’ll most likely end up writing my own since I’m sick/stupid that way, but I’ll leave that decision for tomorrow. I’ve gotten a little more than I thought I would done today considering that I’m squeezing this project in on my off-work hours. Hopefully tomorrow will be a little better, and the site will start looking like something.