Skip to: Site menu | Main content

michael's blog

Adding Node Counts to View Titles in Views 1.x

It is often desirable to add a node count to the title of a view to help users gauge how many nodes have been returned - especially when using exposed filters.

In Views 1.x, this is a fairly simple process using the "hook_views_pre_view(&$view, &$items)" function (documentation).

Let's say you have a view that displays titles and authors all content of type "story" on your site in table format. Furthermore, you've exposed the "Node: Author Name" field as an exposed filter for the view:

Base view display

Submitted by michael on Fri, 11/14/2008 - 3:23pm
Filed under:

Author Biographies on Nodes Using the Content Profile and Views Modules in Drupal 6

Collecting and using user profile information has always been a popular aspect of the Drupal module scene. The Profile module (part of Drupal core) has always been a relatively straight-forward way of collecting additional profile data about users, but its lack of default Views and CCK integration has been problematic for most users.

Saving user data as nodes has been possible using a variety of methods for quite a while, but it seems that with Drupal 6.x, things are coalescing around the Content Profile module. This allows you to set a particular CCK content type as a user profile (the module actually creates a default "profile" content type automatically for you) - thus gaining all the advantages of CCK and Views (and their associated universe of modules) when dealing with user profile data. This is extremely powerful and lets you do all sorts of wacky things with your user's profile data (don't be evil).

This article talks about the (relatively easy) process of getting the Content Profile module configured for a Drupal 6.x site. Then, I'll go through the process of making one of the profile fields available to Views and a template file for use when displaying a node. This might be useful if one of the Content Profile fields you're collecting is a short biography of the user that you want displayed within any nodes the user has authored. Then, your standard node view can look like this:

Short Biography display

Submitted by michael on Mon, 11/03/2008 - 6:12pm
Filed under:

Site Updated to Acquia Drupal

Seeing how Drupal consulting is about 90% of my business, I figured it would be a good idea to upgrade to not only the latest version of Drupal, but the first commercially supported version - Acquia Drupal. While most of my clients are still focused on 5.x, I have begun recommending to new clients that they use 6.x and consider using Acquia's support services.

Submitted by michael on Mon, 10/20/2008 - 11:21am
Filed under:

Drupal Stuff (and more) at BarCampChaos

I attended BarCampChaos at the Orlando's Marriott World resort on Monday evening, October 13, 2008. The BarCamp was piggy-backed on Create Chaos, a conference for creative professionals. Ryan Price gave a presentation on developing an online portfolio site using Drupal, and I gave a 20 minute presentation titled "Anatomy of a Drupal Theme".

Submitted by michael on Tue, 10/14/2008 - 8:42am
Filed under:

Developer's Quick Tip - Working with Memcache and File Uploads

As a Drupal developer and recent memcache convert, I now know the joy of speedy caching.

Memcache actually comes with 2 modules: the main memcache code as well as "memcache admin" which, as far as I can tell, is really only necessary during devlopment and testing of the site (sort of the same way the Views UI module can be disabled after a site goes live).

When using Memcache with Drupal 5.x (it hasn't been ported to 6.x yet, but there is some ongoing work), there's a big "gotcha" that has gotten me on more than one occasion - the "show memcache statistics at the bottom of each page" option on admin/settings/memcache.

Submitted by michael on Fri, 10/10/2008 - 1:52pm
Filed under: