Sunday, April 30, 2017 06:53 am EDT

Drupal 7

Bri's picture

An Example of Using db_query in Drupal 7

If you are writing your own modules, there is a good chance you have used db_query quite a bit in the past. The database layer has been overhauled in Drupal 7, and as a result, the way you get query results has changed slightly. Here is an example to how you how it's used.

// Notice the place holders are now done using the same syntax as PDOs (:uid)
// Placeholders also don't need to be quoted anymore.
$uid = 1;
$result = db_query('SELECT n.nid, n.title, n.created
FROM {node} n WHERE n.uid = :uid', array(':uid' => $uid));
Bri's picture

Template suggestions for Drupal 7 - theme_hook_suggestions

I decided to take some time to figure out how template suggestions work in Drupal 7 being that the release date is getting very close. At the time of this writing Drupal 7 is in RC 4, but they are saying that it will be released officially on January 5th of 2011. I have been working with 7 for a few weeks and finally decided to see if I could get the template suggestions to work. A few things have changed, but they are not that much different from the way they worked in 6. The first difference is that 7 uses a double "-" for its templates by default.

Bri's picture

How to Patch a Drupal Module on Windows

If you use Drupal on a regular basis, chances are that you will want to apply a patch to a module at some point in time. Perhaps somebody has posted a patch in the issue queue that sounds like it will address a problem you are having. Patching files on windows is simple. Just follow these steps.

1. You will need to download the patch software. You can download the Patch program at http://gnuwin32.sourceforge.net/packages/patch.htm

2. Run the setup file and install the program using all of the default settings.

Syndicate content