Drupal 6

Drupal and permissions - avoiding 'The directory sites/default/files is not writable' error

Have you moved a Drupal site to another server and received the error 'The directory sites/default/files is not writable' ?  The site worked on the previous server, and the permissions seem the same. Ah, an easy fix...make the permissions for the files directory 777. Noooo!

Let's take a look at what the numbers in the permissions setting mean.

Creating a Custom Content Type with Fields from a Drupal Module

I was recently working on a custom Drupal 6.x module that needs to create a custom content type with fields upon installation. I did quite a bit of hunting for how best to do this. There are a few different approaches, including using the Features module, or having my module do all the node and db handling, etc. I decided to use the export and import features of CCK, and it's very easy to do. Here is a link to the handbook page at DO that explains how to do it.

No Soup for You!

I was working on a new Drupal 6 module, and at least until things became more complex, I was writing it in a top-down manner: the .info file, the .install file, and was working on defining permissions via hook_perm().

It should have been very easy. I created the following:

Woes_0: Retrieving the CORRECT File Name in Drupal

I was working on a module that uses a query with a few joins to select an appropriate node and then obtain the name of a file attached to it. The file name is then built into a link. Occasionally, clicking on such a link would result in a 404 error. I detest intermittent errors as much as any developer or support tech. It seemed that the common factor with this one was that the files in question had suffixed names, _0, _1 and so on. And therein lies the answer!

Where do the suffixes come from, and why?

Drupal - Making 2 Links from a View Field

In a Drupal view, one of the presentation options for a selected field is to have the field be a link to its node. What if you need the label to also be a link? No problem! Another option is to rewrite the output, so you can manually create the links using HTML, and specify the replacement pattern of [nid] for one. The only problem is that when a field is a link to its node, the URL that appears is the path alias, mydomain.com/my-content, but when using [nid] in a manually constructed link, the resulting URL is mydomain.com/node/##.

Drupal - Low Memory: Not Always a WSOD

So the Content menu page (admin/content) on a stable production site loaded, and the only menu item listed was Comments...yet, the admin menu in the left nav listed all the usual suspects. WHAT was this?!

I checked the database, and the system section seemed fine, as did the record count of other tables as compared to the staging version of the database.

I strolled on over to admin/modules, and lo and behold, the Site Building section of admin was missing Blocks, Modules, Views and more. Though again, the left nav seemed fine.

Drupal 6 Multi-Site...Where Are My Images?

If you convert a Drupal site to a multi-site configuration, you will very likely notice a disturbing side-effect: your images no longer appear!

In a standard configuration, your images will likely be in the sites/default/files folder. Let's say that we have created a multi-site configuration, and our original domain is mysite. So, now we will have a directory of sites/mysite/files, to which we will move the images, and herein lies our problem.

Subscribe to Drupal 6