Items tagged Drupal

Something I've only just discovered the usefulness of is code templates in Netbeans. I always used to have autocomplete set up in Outlook for common phrases like "if you have any queries, please get in touch", and saved a lot of typing. Having found the NetBeans templates module for quickly creating common bits of Drupal code, I started digging around in the default NetBeans options, and found that there are all sorts of little timesavers. Here are a few good ones:
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.
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:
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
Drupal 7 has this feature in the UI, but for Drupal 6 I keep going back to this post on FreshBlurbs- I really should remember it by now. Anyway, here's a slightly amended version that I prefer.
It's a good idea to theme the error pages on your site. It looks more professional and provides a better experience for your users. A lot of people have a soft spot for the Twitter fail whale. Some people really love it. You can also add functionality to help keep your visitors on the site when they get an error.
The Drupal admin interface doesn't allow you to create multiple users with identical email addresses. This is probably a good thing, but recently a client came to me with a requirement for just that. Someone needed to create two user accounts, but they only had one email address. All I needed to do was create a new row in the users table, copying the info across from another row, and all was well.