Tutorials

US States list for CCK select boxes

Published August 22, 2008

When defining Content Types in Drupal with the Content Construction Kit you are able to add select boxes to them with CCK. It takes its key/value pairs in this format: Key|Value. One of the most common tasks for this is to create a drop down list of US States. So to save folks some time, I have compiled a list for you to paste right into your own projects. The attached text file will give you US States in the expected format. Hopefully this will save others a bit of typing when you need such a list for your own Drupal projects. Enjoy!

Drupal Theming: $path vs. base_path and path_to_theme

Published August 20, 2008

When developing Drupal themes, there is one bit of code you type over and over again: sites/all/themes/blueprint/images/whatever.jpg Where images/whatever.jpg could be a css file, or other file, but is normally an image. However, since clean URLs in Drupal appear to make fake directories, the web browser thinks your image is located in: node/345/sites/all/themes/blueprint/images/whatever.jpg When it's not. Luckily Drupal has tools to help you in this case.

Using Views 2 and Drupal 6 to Create a Related Pages Block

Published June 17, 2008

Today's question comes from Dale at NFi Studios in Orlando, FL - my home town: Essentially:, what i'm trying to do is 1. Determine the current nodes taxonomy terms 2. Determine all other pages that share taxonomy terms 3. Display the title (and link) to those pages in a block Using Drupal 6.2 and Views - Looked at a few modules, but nothing quite exact - Reviewing some module snippets right now to see if I can potentially use an argument to do it.

Using AWK to Download and Unpack Drupal Modules

Published June 16, 2008

When installing a new Drupal site (or when your list of available updates gets nice and long), you'll often have to download tons of modules, unpack them, and copy all of the resulting directories to your sites/all/modules directory. Personally, I'm not a fan of all the clicking, downloading, unzipping and most of all waiting! Today I finally settled on a workflow that gets the job done, and it's called the UNIX command line. If your server doesn't use some flavor of UNIX or Linux, or if your web host doesn't allow you shell access, you may want to stop reading after the next paragraph.

Creating Modal "Please Wait..." Dialog Boxes with jqModal jQuery Plugin (Drupal 6)

Published February 24, 2008

Part of the power of having jQuery integrated with Drupal is the ability to take advantage of the strong jQuery developer community. There are many, many plug-ins for jQuery that can add some great functionality to your site - usually with very little code. jqModal is just one of these plug-ins. It can be used to create modal (or non-modal) dialog boxes. In this example, I'm going to show you how to use it to create a modal "Please Wait..." dialog box. This can be useful when your user submits a form that might take a few seconds to process

Editing HTML around Displayed View Fields: Views Theme Wizard

Published January 26, 2008

Question #2 also comes to us via our Facebook forum Modifying existing views. Michael Blake (Orlando, FL) wrote on Jan 24, 2008 at 12:08 PM. I'm working on an existing Drupal application that has a custom Content Type. This includes some custom fields. When I change a custom field, such as add markup before and after it, This does not appear in my views. I think it's because my Views have been exported. However if I change the .php files in the themes directory directly on the server, I get what I want. My question is , if I go about it this way, can someone else come along export a view and erase my changes? Or do I need to re-export every time I make a change? Thanks.

XML Sitemap not associated with pathauto url aliases

Published January 23, 2008

This question comes to us from our Facebook forum. It feels good to answer, because this is the first of many questions we'll be answering here on the site. Some Help I need (XML Sitemap) Omar Eduardo Fernández (MIT) wrote on Jan 8, 2008 at 5:52 PM.So right now, I've been trying to fix an issue I have on my website. I imported everything I had from WordPress (posts, comments, categories/tags, etc), and then I installed the pathauto and the XML Sitemap modules. The problem I'm having is that XML Sitemap is producing a sitemap with every link in terms of nodes rather than the aliases my pages now have, and I would strongly prefer it to use the aliases. My NEW content is being included in the sitemap using aliases, but all the previously imported content is in the node format. You can look at my sitemap if you're not sure what I mean, is http://omareduardo.com/sitemap.xml Thanks for any help! -Omar