Drupal

The Bleeding Edge

Some would say that I'm crazy using Drupal 7 Alpha 5 to relaunch my blog, but I needed D7 up and running for the new book anyway, and some would say anyone who has churned out code as long as me must be crazy anyway, so it doesn't much matter. Sure, it's bleeding edge, and not ready for prime time, but it works well enough at this point, and a couple months some daytime soaps won't kill anyone.

D7 - CCK in Core?

If you're a Drupal developer, you're aware, no doubt, of the coming of D7. One of the exciting changes in D7 is that CCK has been brought into core...somewhat. The changes provide opportunities to do things that were much more difficult to do before, but also, might create a black hole of challenges in the migration space between D6 and D7.

Ubercart - There Were Problems Getting a Shipping Quote

It can be very frustrating to do what seems to be everything needed in order to receive USPS shipping quotes in Ubercart, only to receive There were problems getting a shipping quote. Please verify the delivery and product information and try again. after clicking the button to receive one. Here is a list of the things to verify before throwing anything in frustration!

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.

The Secret to drupal_add_js

drupal_add_js() doesn't add javascript or jquery to your Drupal page? Let's take a look at why, and how to fix it.

Sometimes we need javascript or jquery in our Drupal page. If the script needs to appear on every page, we could just add it to our page template, but what if we want it only on one page?

We could create a page template for the page on which we want it. If the requirement is static and small, that is a way to do it, though putting the script directly in the template is not the best-practices way to do it, for several reasons.

Fee Fid Fo Fum - Retrieving an Image with a FID in Drupal 6

I had the need to add an image tag to page output that was generated inside a custom Drupal module. I had retrieved the image's FID (file ID) from the CCK field, and needed to get from there to having an ImageCache version of the image displayed. I'd done it within a view by selecting the appropriate field format in the Views UI, but how to do it in code? Like many other tasks in Drupal, the solution turned out to be easier than the hunt for it.

Subscribe to Drupal