Adding IDs to all Fieldsets

A themer on a project I was recently working on needed a lot of CSS IDs added to fieldsets throughout the site.

Fortunately, there's a theme_fieldset() function in includes/

I was able to copy that function into the phptemplate.php file, obviously change theme_ to phptempalte_ in the function name, and then add logic that adds an ID based on the fieldset name if an id does not already exist.

Here's the code:

* Format a group of form items.
* @param $element
* An associative array containing the properties of the element.


Q-Views is a module I came across while browsing through new modules on

It's been a while since I've been so impressed with a module. This allows you to create views based of SQL. You allow it to analyze your SQL and it will populate a list of options for each field your query returns.

You can write module hooks to handle the query output on a per-field basis, or you can write the handler directly in the configuration.

Carl Sagan Day

"If you wish to make an apple pie from scratch ...
... you must first invent the universe"

I don't often move off the subject of code on this site, but Carl Sagan has always been an inspiration on numerous levels.

November 7th, 2009, which is the 75th anniversary of his birth, has been declared the 1st annual Carl Sagan Day.

... And here's a nice remix tribute via Youtube to the man.

Zend Server CE, Free LAMP Stack for Mac/Linux/Windows

I recently installed Zend Server CE on my MacBook Pro to check out the performance of the "partial page" caching Zend offers in their platform.

I was pleasantly surprised how simple it was to get up and running. Zend Platform CE installs its own version of Apache, PHP. If you're installing it on Windows or Mac, it will also install MySQL.

Everything is configured and controlled in your zend path. By default on the Mac it is /usr/local/zend.

Subscribe All Users to a Simplenews Newsletter

There's been a couple times where I've had to subscribe all users to a new newsletter.

I started out with a snippet I found which cleans up the subscriptions, but I lost the link or I would have referenced it here.

Here's the code that will subscribe all users to newsletter node id 16. Note I'm using mysql_insert_id() as a quick fix so you will need to use another method if you're not using mysql.

$result = db_query("SELECT uid, mail FROM {users} WHERE uid>0");

while ($row = db_fetch_object($result)) {

Drupal do_search limit is hard coded to 10 - Here's a work-around

Recently I had to implement a custom search function using Drupal's do_search() function. I needed to display many more results than 10, which is hard coded in the function.

The simple solution was this:

1. Go to (make sure you get the function for the correct version of Drupal you are using)

2. Copy the function and rename it to something like do_search_custom.

3. Add a parameter called $limit and make it default to 10. ( $limit=10 )

Disable TinyMCE in Node Body Based on Node Type

There's been a few sites I've used WYSIWYG editors on recently where I've run into the issue of needing to disable it on certain text areas. TinyMCE supports this with a theme override just fine, however, it's not so simple when you have multiple text areas with the same name.

Take the node edit form. For every node type, the body uses the same name.

A practical example of when you would need to disable a WYSIWYG editor would be when filling a node body with previously designed HTML like when you design an HTML Newsletter.

Entertaining Youtube Videos by Appcelerator from ZendCon 08

Yes, I read the Zend Newsletter because usually I find something new in it. This issue was no disappointment as they featured some videos put together by Appcelerator, a sponsor at ZendCon 08. They interviewed attendees in a series of 4 topics: Developers LOVE PHP, PHP Developer Gripes, Developers HATE PHP, and The Best PHP Applications.

Drupal Search : Index All Fields of a CCK Node

The Drupal Search API is powerful and pretty intuitive, but finding details on how to do something as simple as enabling searching on fields other than title and body could be a little daunting.

It's actually quite a simple concept. Anything exposed to your node view will be indexed. You can easily accomplish this by editing your content type and setting the Display Fields setting to Plain Text.