Always Moving, Part 3

The Views module has to be the greatest thing that has happened to content management since Microsoft ceased supporting IE6. Want a list of the latest posts? it can do that. You want a block displaying the top rated content? It can do that too. List users? Check. If you have content, the Views module can spit it out any way you like it, and let you theme it, too.

I needed a couple different views to finish up my site. I wanted to list and display the portfolio content in an attractive way, and I wanted a cool little block that displayed the latest portfolio entries.

The portfolio content type carried the usual stuff, description, title, etc. It also gave me an array of images for the item. I wanted to be able to display the images in an attractive way, even when I didn't know how many items there would be. I decided to have the view spit them out in an unordered list, and style the thing in a horizontal line, hiding any more than 3 images.

A little jQuery animates the whole thing to slide over and display the hidden images, if there are any. jQuery comes native with Drupal, so one just needs to create a new js file and include it in the template's .info file to include it on every page, but not wanting to waste the bandwidth, I wrote a little template function to load the file only on portfolio pages.

The the Thickbox module gave me the lightbox function I was looking for.

Finally, I made another quick view that only loads the four newest portfolio nodes and spits out just the thumbnails as links to the full node. I then created a block from it. A little CSS gave me just the right look.

At the end of the process, I had created a nice, clean blog template on a CMS that is very easy to update. I might not even change it for a few months!