Drupal's labyrinth can be scary.
Let Bright Bacon help you navigate it.

Featured Clients

If you've got a AAA membership on the west coast, chances are you've seen a...

GreenAnswers is a free question and answer site where anyone can ask, answer...

Founded by composer and musician ...

Latest Blog Entries

Knowing Your Body and Practicing Safe CSS

This is a quick trick I picked up to guarantee that any css changes you make only affect what you want.

There are different ways to identify the page you need to change. I tend to use url as it's always unique.
Here's how:
Locate the template.php file for the theme your working on and add something like this to the page_preprocess function

  1. function your_theme_preprocess_page(&$vars) {
  2. // Add a custom body class for specifc page
  3. if ($_REQUEST['q'] == 'example/page/new-body-class') {
  4.   $vars['body_classes'] .= ' custom-body-class-name ';
  5. }

IE Blew Up My Layout!!!

We've all experienced it, you've themed out a page and it looks fantastic in Firefox. Unfortunately the time has arrived for your IE testing... You've dreaded it the entire time and have put it off. You fire up your windows testing environment and your worst nightmare has come true. The entire layout is blown out. Divs are strewn about like your tpl.php ate a hand grenade.

Don't Repeat Yourself: Enterprise Data is Hard

I usually like what Ted Dziuba has to say but his rant, The Most Important Concept in Systems Design, missed the mark on a few points and ultimately misunderstands the problem on a fundamental level. Go read Ted's article if you haven't already, then we'll jump into some counterarguments and finally why the whole rant is misguided.

Ready?

1. Using Solr to Search a Database

db_affected_rows() is annoying

Given the following Drupal code:

  1. db_query("UPDATE users SET dummy_column = 'foo'");
  2. printf("Records affected: %d\n", db_affected_rows());

and assuming that dummy_column doesn't exist in the users table, what is printed? Here's a hint from the php manual:

mysql_affected_rows()
Returns the number of affected rows on success, and -1 if the last query failed.

If you said "-1" like me, you're wrong (at least some of the time). The code above will return "1" if you have watchdog enabled.

On Taxes, Estates, and Natural Rights

This is a response I wrote on a message board that I didn't want to get lost in the ether. It describes my thoughts on estate taxes and wealth generally pretty well, I think.

First, the comment to which I'm replying: