Welcome!

Tags: Drupal, Drupal 6, Drupal 7, reference

The following is a list of the United States in key|value format. It's useful when creating a select list in Drupal.

AL|Alabama
AK|Alaska
AS|American Samoa
...
Tags: Drupal, Drupal 6, Drupal 7, reference

The following is a list of countries in key|value format. It's useful when creating a select list in Drupal.

AF|Afghanistan
AL|Albania
DZ|Algeria
...
Tags: contrib, Drupal, Fivestar, hook_mail, PHP, votingapi

The Voting API is really nice when used in conjunction with a module like Fivestar. It takes all of the complexity out of setting up a voting/rating system. On occasion, however, you need it to do some things that aren't built in. Using the VotingAPI's API, I'll show you how to trigger a function (send an email, write a message to the screen, etc.) when a piece of content receives a fifth vote of four stars or greater.

Tags: Drupal, Drupal 6, hook_form_alter, PHP, theming

Many components in Drupal have an optional title or description field. This text usually displays when a user hovers over an item. We had an interesting request: a client wanted to have a box that displayed text which would change every time you roll over a menu item. This can be accomplished using just a small amount of jQuery, and Drupal's built-in menu handling.

Tags: Drupal, Drupal 6, PHP, taxonomy, Views

This example serves as both an example of how to alter a Views2 query, as well as how to use the get_terms_by_count() function I've written.

Tags: Drupal, Drupal 6, PHP

The following steps will get you a completely rebuilt Navigation menu.

Tags: Drupal, Drupal 6, PHP

After the break, you'll see one example of performing an action based on whether or not the current user belongs to a certain role or roles. Note that the admin user (UID #1) matches as well.

Tags: Blocs, Drupal, Drupal 6, Views

You can pass any number of arguments to a Drupal block by providing default arguments. The screenshot (after the break) shows what an argument might look like in Views2.

Tags: jQuery
$(document).ready(function() {
  $("a[href^='http']").not("[href*='mysite.com']").attr('target','_blank');
});

... and to match two urls/domains/whatever:

$(document).ready(function() {
  $("a[href^='http']").not("[href*='mysite.com'],[href*='mysite2.com']").attr('target','_blank');
});
Tags: Drupal, Drupal 6, PHP, theming

When we build Drupal sites we typically have a lot of custom design elements. It is important to be able to display images from the filesystem in a dynamic fashion (non-absolute paths). Should you need to move the site, you wouldn't want to have to reset image paths everywhere. The base_path() and path_to_theme() functions do all of the dirty work for you.

Pages