Jump to Navigation

Blog

23 Jan 2012

Here's something I picked up from the designers at Catch Digital. When showing site mockups to a client, they would create a directory of images, and build a series of simple HTML pages, each one linking to the next. This allows the clients to click through each mockup and easily see all the designs. The last

The directory would be protected by an .htaccess password, so that only authorised people are able to view the designs.

I've improved the process by using PHP to loop through the directory and create links for each image.

26 Dec 2011

I'm a sucker for articles on sites like Lifehacker about online productivity tools.

I've tried loads of apps and online to-do lists, but I still think nothing beats writing a list on a piece of paper, and putting that piece of paper somewhere obvious, like just above your computer monitor. 

9 Dec 2011

I always thought it was very easy to add a JavaScript print page link to a page - all you had to do was add a simple line of code:

<a onclick="window.print()">Print this page</a>

All good, and the page prints. However, it turns out that this causes the page to reload, and if the page includes a form, and your user has started entering data, they'll lose the data, and won't be happy.

8 Dec 2011

On a drupal 6 site, I wanted to create a custom block, but I also wanted to make sure that it would be easily themable. For some reason I couldn't find a good example of how to do this, so here goes.

For logged out users, the block would show the login form, but it would also show an extra menu. For logged-in users, it would show a different menu and some additional content.

I created a custom accountblock.module to do all this, and defined the menus using the admin UI.

31 Oct 2011

My least favourite part of developing is trying to fix other people's bugs. Most of the time the code isn't properly commented, isn't nicely formatted, and it often isn't even clear what is supposed to happen.

Here are a few things that can sometimes help.

As well as the indispensable Devel module, PHP's native magic constants can be a real help. Here is an example:

29 Aug 2011

Not in any particular order, and far from finished, but here is my advice to cyclists in big cities:

21 Aug 2011

I've started work on building a mobile version of The Gallery Guide, my pet Drupal project. The main site has been built to be very visual - it's got a lot of images, Google map embeds, and most of all, it's got a lot of views. Pretty much the whole site is built on Views.

The Mobile tools module has made the whole thing pretty easy to set up - a couple of hours tinkering and I had a usable mobile site with

21 Aug 2011

Here is how to build a set of timezone clocks using PHP, jQuery and CSS3. It's based heavily on Toby Pitman's example, and even uses his images.

I've added the extra timezones using a PHP array. In theory it would be possible to do it all in Javascript, but PHP is good at handling dates, and there's no need to do any horrible maths with timezone offsets. Just tell the server which timezone you are interested in. 

9 Aug 2011

A while ago I started using Google Plus. I'm yet to be convinced of it's value, but I'll stick with it. As with Twitter, I started following a few people I know of through the Drupal community, including Earl Miles, the creator of the Views module. I've never met Earl, but he seems like he really knows his stuff. I use Views all the time, and thought he might be a useful person to follow.

4 Aug 2011

All I wanted to do was take a big folder full of PSD files and turn them into JPEGs, so that I could view them more easily without having to wait while Photoshop opens every time.

Fine, I thought - Photoshop has a batch processing function. Trouble was, it would keep asking me to navigate to the save directory, choose a filename, and choose the JPEG quality.

There's usually a way around things, that isn't always obvious.