Robert Kent

Personal blog of Robert Kent

PHP: Download an array as a CSV file

Often it is necessary or useful to output an array of data in PHP as a CSV file. The below script will take a 2 dimensional array and output a CSV file. Internal arrays must have the same keys. These keys may be set to null, but the key must exist. Below is a sample array that we can work … Read More

Sending HTML emails with Drupal

I’ve set up a few sites that send out email notifications using Rules, commonly for sending out a notification when a user adds a comment to the site so that a site administrator can review it and approve or remove it. The default plain text format for these emails is a little lacklustre. It would much better is we could … Read More

Drupal: Creating a Related/Similar View block with Taxonomy

Often when displaying a node in Drupal, such as a news article, event or profile page, it is useful to display a few related pieces of content. This can be achieved by using a taxonomy field on your content and a view. To create a view to display other nodes with the same taxonomy term as the current node Create … Read More