Drupal articles

Drupal TinyMCE buttons displaying on multiple lines

1st May 2008

A quick post about the Drupal tinymce module and it's tendancy to display all it's buttons in one inflexible line. The following CSS will split the tinymce buttons onto several lines.


.mceToolbarTop * {
  float:left;
}

.mceToolbarTop select { width:auto!important; }

.mceToolbarTop option { float:none; }

Read more

Drupal mysql utf8 and latin1 character set issues

27th Apr 2008

Upgrading from Drupal 4.6 has always been complicated by issues of character sets, but the Drupal upgrade scripts normally solve most of these problems for us. But when your dealing with a complex upgrade you need a good understanding of how Drupal is dealing with character sets in Mysql.

It all comes down to this - pre 4.7 Drupal stores utf8 encoded data in latin1 based tables (although this sounds a bit silly there were good reasons for it). From 4.7 onwards Drupal stores ut8 encoded data in utf8 encoded tables. The process of converting from one method to the...

Read more

Drupal Problem with the admin/content/node page filter

15th Apr 2008

A rather obscure one this, but we found a problem today on one of our Drupal sites with the filter form on the node admin screen (admin/content/node). Changing the filter settings on the form had no effect, which prevented you from filtering the list of nodes. We tracked the solution down to the $_SESSION array being cleared between page reloads, and a quick google pointed the finger at the Remember me module. Disabling the module solved the problem

Read more

Increase the performance of Drupal's ubercart for sites with a large number of products

12th Apr 2008

We are in the process of putting together a large (20k products) store with ubercart and ran into some performance issues due to the hook_forms implementation.

The problem obviously is that a form is being registered for each product regardless of if that product is being displayed or not. This is a bit unnecessary, so our solution was to do the following :

  • comment out the hook_forms implementation in uc_product
  • write a little module that keeps tabs on which product nodes have been loaded and implements hook_forms to register forms for only those products,

We have attached the module below...

Read more

Bulk deleting Drupal nodes of a particular content type

12th Apr 2008

The Drupal admin interface allows you to delete up to 50 nodes at one time, which is great - but there are times when you it's just not enough and you need to bulk delete many thousands of nodes.

In this example we will delete all nodes of a particular type (page), a quick way to execute the code is to create a new node, set the input format to PHP, paste the code into the node body - add a title and click submit - don't forget to delete the node when your done!


  $node_type = 'page';
  
  //fetch the...
Read more

Drupal image assist force a default alt tag

8th Mar 2008

We make heavy use of the Drupal image assist module (or img_assist as its known) - but find that its handling of empty alt tags is quite poor. The problem being that if when inserting the image the user does not specify a caption or description then the alt (and title) attributes are both empty.

This is clearly not ideal on a modern standards compliant site - luckily the solution to the image assist alt tag problem is a little theme override.


function phptemplate_image_display($node, $label, $url, $attributes) {
  if (!$node->title){
    $node_temp = node_load($node->nid);
    $node->title=$node_temp->title;
  }
  return theme('image', $url, $node->title, $node->title...
Read more

Multilingual views in Drupal when using i18n module

1st Mar 2008

Building multilingual sites in Drupal using the i18n module always throws up a few fun problems to be solved. One of the most awkward being views.

The i18n views integration module does an excellent job of allowing you to return only nodes matching a particular language, but it doesn't help when it comes to translating the view itself - and more importantly allowing a view to site nicely into multiple positions in the menu (one per language).

The solution is to use the excellent insert view module (http://drupal.org/project/insert_view - you can use this guide to get the module and...

Read more

Drupal 6 is released - hoooooray!!

13th Feb 2008

Well, it's finally happened - the brand spanking new Drupal 6 has been released into the wild. We have been playing a lot with Drupal 6 and getting ourselves quite excited (finally drupal_execute has decent return values, and the menu system feels a bit less 'brutal'). However, while we would love to start building client sites on it there is one major omission - the views module.

Suffice to say there have been many discussions about the core-worthyness of the views module, so I am not about to start another one here! Instead I'll just say a HUGE thank you...

Read more

Drupal themeing : Adding active class to the Drupal primary links

29th Jan 2008

This little snippet lives in your phptemplate_variables function and will set a useful 'active' class alongside the not so useful menuid-active class which Drupal assigns to the active primary links


foreach($vars['primary_links'] as $key=>$link){
   if (strpos($key,'-active')){
      $vars['primary_links'][$key]['attributes']['class']='active';
   }
}
Read more

Drupal 5.6 bug affects prevents saving of HTML filter settings

26th Jan 2008

Just flagging this as a bit of an issue - it appears there is fairly serious bug in the version of the filter module provided in Drupal 5.6 which prevents you from saving changes to the allowed HTML tags

A patch is available on drupal.org but it's quite well hidden! Post number 7 in this thread contains a working patch http://drupal.org/node/208700

An alternative solution is to download the 5.x HEAD http://drupal.org/drupal-5.x-dev) and take the version of the filter module from there

UPDATE This has now been fixed with the release of Drupal 5.7

Read more