Drupal 6

Tags: Drupal, Drupal 6, PHP, Ubercart

This tutorial is for Ubercart versions later than version 2.3. If you're using an older version of Ubercart, you'll want to see this example. This example is very similar, but accommodates the changes made to the template system in Ubercart.

Tags: Drupal, Drupal 6, hook_form_alter

Using hook_form_alter one can easily add a "Reset" button to a Drupal form.

Here's a simple example:

Tags: Drupal, Drupal 6, hook_form_alter, i18n, taxonomy, Views

I've been working on a multilingual site that has a product finder. We have 3 exposed filters that allow a user to select an Activity, IP Category, or Industry. All of these filters are Taxonomy Term filters. Some of the terms throughout those vocabularies have a specific language set, and should only show when that language is active.

Tags: Drupal, Drupal 6, hook_form_alter, webform

I've spent a lot of time working with hook_form_alter() functions to modify forms, but the other day I was stumped by a simple problem. I needed to have two submit buttons on a form. By default, in the latest branch of Webform, you can change the text label on the default submit button for a webform.

Tags: ajax, Drupal, Drupal 6, hook_menu, jQuery, webform

This example is a two-for-one deal! I'm going to demonstrate how to

  1. dynamically populate a webform select list on page load
  2. dynamically populate a webform select list based upon the value chosen in another webform select list
Tags: Drupal, Drupal 6, location, Views

The location module for Drupal 6 is a robust module. On most projects, it gives us 100 percent of what we need. Proximity searching based on zip code is built-in and fairly painless to setup. I've recently been tasked to also allow proximity searching based on City. As you might imagine, the request is very similar. Both methods require the use of latitude and longitude (decimals).

Tags: Drupal, Drupal 6, taxonomy, Views

Note: If you're looking to just output a list of taxonomy terms that link to a custom view, please see PHP Code to Output a List of Terms Linked to a Custom View. If you need actual Drupal menu items for each term in a vocabulary to point to a custom view, please read on.

Tags: Drupal 6, taxonomy

Quick Tip: Getting a list of taxonomy terms is easy using a view (type: Taxonomy). Trying to get only terms at the highest level is a bit trickier. One method I came up with is to add a Taxonomy: Parent term argument on the view. The key is to tell the argument to Provide default argument of PHP Code and set the value to

return 0;

The result is that only top-level terms (terms without parents) are returned.

Tags: Drupal, Drupal 6, PHP, theming

UPDATE: I've had much better luck with the ​nodeblock​ module. I create an "Editable Block" content type (machine name editblock​) and allow clients to edit these blocks. I've stopped using Node As Block.

By default, the Node As Block module displays a node in teaser mode. After the break, I'll show you how to show the full content of the node using a simple preprocess function in your theme's template.php file.

Tags: Drupal, Drupal 6, hook_mail_alter, PHP

We recently did a site for a client that allowed patients to submit a webform to request an appointment. The user could choose their physician and based on their choice, the submission would be emailed to the chosen doctor's secretary. I originally thought about using the key part of the key|value pair for the select list to store the secretary's email address, with the doctor's name. This wouldn't work, however, because the key could not contain standard email address characters. Read on for the solution...

Pages