DrupalEasy Quicktips are short, focused posts intended to accomplish a very specific goal. Quicktips are exclusively available first via our @drupaleasy Twitter account.

Exposed Filters on Block Views

Exposed filters in Views are a wonderful thing. They allow your site visitors the ability to dynamically alter a view to suit their needs best. But what happens when you display your view in a block?

Exposed filters on View pages use URL querystring variables to pass the filter variables back to the server, but when your view is displayed in a block, this isn't possible.

Setting Default Year in CCK Field

If you use CCK often, then you've probably at least once had to implement a select box where the user can select a year value. Sometimes they're used for birthdays, magazine issues, events, or even historical reasons.

You can easily populate the "Allowed values" textarea of the field's "edit" page, but how can you quickly set the default value to the current year (and not have to worry about changing it every year)?

Browser FAIL: "Unsupported form of compression" related to PHP notice

One of my sites had a funny error complaining about an "unsupported form of compression" shortly after installing a new module. The browser would return a white screen of death with an error message (Safari and Firefox).

Content Encoding Error
The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.

Showcase a User's Comments with Views and Menu Tabs

By now, you should know and love the Tracker module that comes with core. It has its strengths, but many weaknesses. For one, you can't separate out posts from comments, or sort the list in interesting ways. Views can help you make exactly the list you want, and place it in a tab on the user's profile exactly like the "Track" tab.

For this example, you'll be adding a list of comments. Creating the view is simple enough:

  1. Clone the default view comments_recent, and call it comments_by_user
  2. On the Page display, add a Relationship for Comment:User

Adding photos to an event page with Views Attach

There are often 17 ways to do any particular action with Drupal - here is #18 on the list of "How do I display related content on this node's page?" You'll be using the Views Attach module and a nodereference field.

In this example, you want to relate a photo to an event. Inside the photo's content type, create a nodereference field that is able to reference the event content type. When a user is adding a new photo, she will be able to choose the related event if applicable.

Extending Ubercart Functionality, Part 1

As terrific as Ubercart is for turning your Drupal site into an ecommerce powerhouse, there's a lot of additional modules that can extend its functionality. Here's a quick look at just a few of them:

Donations - want to accept donations from you site? Among other functionality, this module allows you to create a "product" where your donors to specify the amount they'd like to contribute.

Deciding Which is the Best Module to Use

There's a lot of times when you're building a site and trying to figure out the best way to do something. It doesn't matter if you're a newbie or a rockstar, if you're not familiar with a particular type of funcationality, you're going to need to do some homework to figure out the best solution.

One handy way of figuring out the best solution is by gathering up all the possible modules and comparing them. Unfortunately, this can be quick time-consuming. Luckily, there's an entire Drupal group devoted to exactly this!