AdaptiveThemes Blog

Whats new in Genesis 2

Genesis directoriesToday I released [Genesis 6.x-2x]( Genesis has been through a total rebuild the past couple of months and I've incorporated many ideas and features from my every day work as a Drupal themer.

A little slice of history. Genesis was born out a pile of snippets, templates, stylesheets and ideas that have been slowly accumulating in my code library for the past couple of years. Genesis 2 stamps some order on this as well as sweeping away the [cruft]( and imposing a new structure that reflects the way I work.

Print Comments anywhere, and the Form as well

Drupals standard practice of printing node comments below the node can get a bit stale. Sometimes you may want, or simply need to, print them somewhere else. Wouldn't be great if comments and the comment form were just variables you could move around?

Well you can—thanks to Drupal 6's phptemplate_preprocess_page function we can easily store both the comments and the comment form in variables. The only caveat is that *you must set the comment reply form to a separate page first*, or something might break.

Using Multiple Templates

This is the third article in the series of Packpub Drupal theming articles from their new book Drupal 6 Themes—**Using Multiple Templates in Drupal 6**.

Most advanced sites built today employ multiple page templates. In this section, we will look at the most common scenarios and how to address them with a PHPTemplate theme.

Show a Unique Header Image based on Path

Many sites want to show a unique header image for a particular section, node or view. There are many ways to achieve this including the the [Header Image]( and [Sections]( modules.

For a recent site build we wanted to avoid the overhead of a module for such a simple feature so I wrote a small function to show a different header image based on the path (the URL alias in this case). The function tests to see if an image exists for the path part (or "section") and if not displays a default image instead. To do this your site structure needs to have distinct sections, something you can create by writing alias's with the Path, and probably Pathauto, modules.

5 Minor Modules My Drupal Site Can't Live Without

Everyone's got their list of "bug guns" they use on every site, you know, Admin Menu, Views, CCK, Panels and so on. I thought I'd look through my installations to see what "minor modules" I use as often as the big guns. This is my short list of those lesser known but helpful little modules that I just can't seem to live without.

So without further ado...

Theme your Search Results

Drupal 6 preprocess functions and templates make a themers life a joy. Remember those ugly function overrides we had to do previously? All that's changed and pita tasks like adding vars to search results is now a 5 second job.

So how to theme your search results? Lets say we want to inject something below each result, could be Google adsense or your mothers recipe for home made pie—lets break it down.

Drupal Starter Themes (test site) Rocks!

Its alive and kicking—yes the [Drupal starter themes test site]( is back up and running. Its bigger, louder and actually more useful than ever before.

Ok ok, the hype is a bit OTT but Adaptivethemes recently migrated to Clook and due to time pressure (yeah, who doesn't have that...) the test sites went on hold for a *while*.

Working with Template Variables

This is the second article in the series of Packpub Drupal theming articles from their new book Drupal 6 Themes—**Working with Template Variables in Drupal 6**.

As we have seen in the first article *[Creating Dynamic CSS Styling](*, Drupal produces variables that can be used to enhance the functionality of themes. Typically, a theme-related function returns values reflecting the state of the page on the screen. A function may indicate, for example, whether the page is the front page of the site, or whether there are one, two, or three active columns (for example, the variable $body_classes). Tapping into this information is a convenient way for a theme developer to style a site dynamically.

Creating Dynamic CSS Styling

Shortly I will be reviewing [Drupal 6 Themes]( by Packt Publishing. As a primer to the review Packt Pub have granted me rights to publish selected articles from Drupal 6 Themes. Here is the first in the series of four articles—**Creating Dynamic CSS Styling in Drupal 6**.

In addition to creating dynamic templates, the Drupal system also enables you to apply CSS dynamically. Drupal creates unique identifiers for various elements of the system and you can use those identifiers to create specific CSS selectors. As a result, you can provide styling that responds to the presence (or absence) of specific conditions on any given page. Two of the most common uses of this technique are covered below: The creation of node-specific styles and the use of $body_classes.

Fix your OpenID Login Icon

Doesn't it bug you that through 10 versions of Drupal 6 that dam OpenID icon is still hiding under the link text? Granted Garlands default styles somewhat mitigate the issue but for most themes the display of the OpenID icon on the User Login block and the Drupal login page remains broken.

In this short article (its not a big problem) I have outlined the issue and offered up a CSS solution that requires nothing more than dropping it in your themes CSS file and making rudimentary adjustments. On with the show!

**Update: my [patch to fix the OpenID icon in Drupal 7]( core passed the test bed but needs some testing in Linux and Mac browsers, if you have the opportunity please test the patch! and has been committed to HEAD for D7 - horray!**

Earth Taxonym - Open Source Global Locations Taxonomy

The Earth Taxonym project was launched this week and proposes to build a global locations taxonomy that will be made freely available to anyone. The basic idea is that you join the site and fill in locations in your area. Locations are arranged in a hierarchy so are highly suitable for categorisation or navigation for many Drupal sites—directories, travel sites, property sites and more.

Setting Blocktheme Classes with subtheme_preprocess_block

I've become a big fan of the fantastic Blocktheme module. Up until now I've followed the README instructions and either built blocktheme templates or just printed the $blocktheme variable in my block.tpl.php and block-xxx.tpl.php templates.

Thats all well and good, but in my current project I wanted to be able to theme blockthemes by region. The main reason for this is we are making just very minor changes to the block styles depending on the region and we see no point in creating additional blockthemes.

ChipIn Fund-raising has Ended

As some of you may be aware I have been raising money to buy Camtasia so I can make much longer video tutorials for Drupal and my Genesis starter theme. The campaign was a roaring success and we raised $255 of the $299 needed and I have of course chipped in the balance myself.

Using hook_theme to modify Drupal forms

I'm going to show you how to use hook_theme to make some commonly requested changes to the Search form and the Comments form in Drupal 6. We're also going to learn how this is done in your Genesis subtheme and the normal way of doing things. Take it as read the that the Genesis method also works for Zen sub-themes since the implementation of hook_theme for subthemes is the same.

Take Control of your Homepage with Nodequeue, Views and Panels

Diagram showing the onion layers in the Drupal front page

Recently we built this site, you'll notice the homepage is fairly customised with lists of content rather than Drupals default river-of-news (or should that be river-of-nodes?). "How to configure" this type of Drupal front page is a common question in the Drupal forums so I'd thought I let you in on the secret, after all, that's what we're here for eh?

For this tutorial you going to need:

Download those modules and install them in your Drupal test site. FYI Informe21 is a Drupal 5 site but the theory holds true for Drupal 6.

Fig 1. shows us the "onion layers" of the layout we're going to build. You can see how each layer is embedded in the other - blocks in the mini panel panes, mini-panel in the region and finally the region is printed in the template file. This is just to give you a visual representation to help you get your head around the concept. Ok, on with the show!

Add <span> tags to Primary links for Sliding Door Tabs

In the upcoming series of Genesis video tutorials I will be presenting a segment on how to build sliding door tabs for Drupal's Primary links.

As you may know to get the full hover effect working in Microsoft's venerable Internet Explorer web browser we need to wrap the anchor text in <span> tags, since IE does not support the :hover pseudo class on anything but an anchor, bless its little heart.

Now, the standard Drupal "fix" for this is to override the theme_links function. I'll detail that here, but first I want to explore another idea I hit on recently - using jQuery to get the job done.

Software Freedom Day - Singapore

Software Freedom Day is a global celebration of Free and Open Source Software.

Sprouting from roots in academia during the 1980s, the Free and Open Source Software (FOSS) movement has grown to profoundly influence the computer industry and the Internet as we know them today. In just over two decades, FOSS has come of age. Today, FOSS applications and systems are viable computer solutions for individuals as well as enterprises.

Transparent PNG images in IE6 with Drupal and jQuery

Out of the box IE6 does not support the use of PNG 32 transparencies. While most of the time this is not a big deal, sometimes you really want, or need, to use images with a transparent background and neither PNG 8 nor gif will cut i.e. you just need more than a few hundred colours.

Thankfully for us Drupal users there's a jQuery plugin called pngFix that we can use to mop up IE6's inadequacies. However, it comes at a price. You can kiss goodbye to clean markup and somewhere along the line there's likely to be trouble.