Water_droplet

Moving from Drupal 6 to WordPress 3.1

I thought it was about time I updated my site as it was running as a Drupal 6 install. I wanted to concentrate on the blogging aspect of the site and thought that WordPress might be closer to what I …
Continue reading

Drupal Module Weight

Sometimes you will be executing a form alter and the $form object passed to you does not match what is coming out on the screen. This is most likely that another module is running after your form alter and changing the form.

So the solution is make your module execute after all the other modules have finished. You can do this by changing the system weight. There are 2 ways of doing this, the first is to install the module order module which is in development at the moment but should do the trick.


Continue reading

Changing the ImageCache Preset On The Fly

Its quite common when making a site to need a different size image for the first teaser than the rest of the teasers in the list. This job is made more difficult because when the CCK image field is sent to the template it only gives you the end result in the $output variable and does not give you the images path.

Its does however give you a file id in the raw data which you can use to load the file object and get all the information you need create a new image from a different preset.


Continue reading

Exports nodes as CSV

The best way I have found to export nodes is through the views bonus pack. After installing that you will see a bunch of new options in the feed display. Now you can select the style of CSV file.

I did notice that the headers are not set correctly but you can fix this by opening up views-bonus-export-csv.tpl.php and adding
drupal_set_header(‘Content-Type: text/x-comma-separated-values; charset=UTF-8′);
drupal_set_header(‘Content-Disposition: attachment; filename=”data.csv”‘);


Continue reading

Drupal Supports PHP 5.3

The new version of Drupal 6.14 now supports PHP 5.3. This news was tacked onto the bottom of the 6.14 release notes and read:


Drupal 6.14 is the first stable release to support PHP 5.3.0, but this might not be true about the contributed modules you are using. Watch out for updates to your contributed modules if you experience problems with PHP 5.3.0 support.

This is great news for me because like many OS X users I upgraded to snow leopard which comes bundled with PHP 5.3 and stop all by Drupal projects from running.


Continue reading

hook_uc_cart_alter

hook_uc_cart_alter is a really useful hook if you need to change items in the shopping cart. It replaces the need to theme all the check out pages individually.

The shopping cart items come through as a by reference parameter. This means you don’t have to return the variable.

$items[0]->title = ‘testings’;
Continue reading

Drupal Location searching by UK postcode

I have been asked to configure the location 6.x-3.1-rc1 module to allows a postcode proximity search. This allows you to search for nodes within 5 miles of a postcode which is very powerful. Out of the box location 3.1 looks like it supports it, however when activated for the uk the search will just return nothing.


Continue reading

New! Garland Based Theme

I have created a new theme based on Drupals very own garland. Nothing has really changed in the default Drupal theme for as long as I can remember. So I thought I would have a go at a revamp and this is what I came up with.

I have kept all of the original styles and put all the new changes to garland in splash.css. This means upgrading this theme to Drupal 7 should be a snap.


Continue reading

Editing a Drupal views query SQL

The Drupal views system is awesome and delivers graphical query building with fast performance. However from time to time you may wish to add certain complexity to your view that the module just cant deliver.

 


Continue reading

Duplicate entry ‘F j, Y – H:i’ ” warning for INSERT into date_format table

After updating to Date API 2.0 we ran the update.php and started to get this error on various pages.

user warning: Duplicate entry ‘F j, Y – H:i’ for key 2 query: INSERT INTO date_format (format, type, locked) VALUES (‘F j, Y – H:i’, ‘medium’, 1) in /xxx/Sites/htdocs/bmi/includes/common.inc on line 3425


Continue reading