Category Listings in Drupal 6


In case you haven't noticed, I upgraded my web site to Drupal version 6 over the weekend.

The biggest challenge of Drupal version upgrades is making sure your theme and modules make the transition. The APIs can change radically between major releases. That means your add-on components won't survive the upgrade unless their maintainers are actively supporting them.

That's why, for instance, this site is running under a simple, barebones theme. The theme I was using hasn't been updated for version 6, so I had to leave it behind.

As far as modules, only one of my add-on modules wasn't available for version 6—and it's one I wrote myself.

I write a module called category_listing that provides a simple, themed list of taxonomy terms. It's what I used to produce my blog categories page.

The enhanced views module comes frustratingly close to providing this capability. I found two limitations.

First, the term description is wrapped in <p> tags, causing unwanted line breaks. I solved this in an extremely hackish way, by using CSS to remove block property from that element. Here is what I used:

.view-content .item-list li .views-field-description p {
  display: inline;

The second limitation is that my module provides article counts in the categories, and I didn't see any way to do this with the stock view mechanism. This is not a critical failing, but the article count is a very nice feature.

So, I did a quick port of the module to version 6 and that's what I'm currently using on this site. I'm going to continue researching whether I can get the standard views mechanism to do what I want. If not, I'll consider going ahead and publish the new version of the module.


Comments have been closed for this entry.

category module

Did you ever upgrade category_listing to v6 ?
I'm new to Drupal, from CakePHP and struggling to produce a decent blog (in half a Sunday).
Categorisation seems so basic that I can't believe it's not core.

Not For V6

No, I didn't do it for V6. I was satisfied that the standard category listing was good enough for my needs. For instance, you can see it in my site here:

That's simply a URL alias for: