Drupal code

  • Views data exports

    Views is the king in Drupal land when it comes to making lists of your data, rightly so, it does a wonderful job of making it easy to choose the data you want to list. It also allows you to render your list in various forms, lists, tables. RSS feeds or even jump menus. So if you want to make a list and render it as CSV or XML, then you naturally turn to views, and find that currently you really have two options:

  • Facebook like views integration

    Facebook is rapidly taking over the planet, and Drupal is arguably trying to do the same. Facebook added the concept of 'liking' a webpage to their array of social tools a while ago. Drupal modules quickly added the ability to 'like' content on your site.

    This is all well and good, but what about getting some of that data back into Drupal?

    Suppose that you have an image gallery, and you want people to be able to rate the images, by 'liking' them using Facebook like. What you'd really like to be able to do then is build a 'top rated' view of those images.

  • Removing that pesky trailing slash

    So, it's perfectly valid to visit a site using a URL like:

    http://www.google.co.uk///////////

    But some pesky SEO types will complain that the site is accessible at two URLs and that you need do a 301 redirect to the canonical URL (http://www.google.co.uk/). What you want to do is remove the trailing slashes using mod rewrite.

    If you really need to do this, then you can just pop the following in the .htaccess file that Drupal provides:

  • Aegir HTTP basic authentication

    Aegir is a system for managing sites using Drupal and drush. We use it to manage this site in fact.

    However, we use a fairly old version. As a precursor to doing some more work on the backup management I wanted to get my head around the new version of Aegir, and the object orientedness.

    There's a really useful tutorial over on the Aegir community site:
    http://community.aegirproject.org/node/75
    That shows you how to add options to Aegir sites and pass the information into the backend.

    The tutorial mentions a possible real life use of implementing HTTP basic authentication on a site. Well, in an effort to understand Aegir more, I've coded it up, and you can now really easily specify HTTP basic authentication credentials for any site managed in Aegir. This is really useful for staging sites that you need to give clients access to, but don't want the entire world seeing.

  • ComputerMinds sponsor the BMF Bastardos

    ComputerMinds are proud to announce an exclusive shirt sponsorship deal with the BMF Bastardos "elite" touch rugby team. Playing in the Bristol touch league the Bastardos had a successful first season picking up the coveted wooden spoon ... luckily there is no proven correlation between touch rugby skills and Drupal development

  • Hiding empty Panels panes

    If you're using Panels to display dynamic content, you might want to dynamically check whether to display the panes based on what will be shown. For example, if there is no content to show in a certain pane, you probably don't want the pane to show at all.

    You may especially want to do this if your theme will do anything ugly, or just unnecessarily conspicuous, with any HTML that is wrapping empty content.

  • ComputerMinds - move into new premises

    ComputerMinds have moved!

    We are all settled in to our new offices on the triangle and are loving the new office - we just can't wait for the summertime so we can enjoy our courtyard (wi-fi has been tested and confirmed working - just need to figure out some kind of sun visor for the screens).

    Our new address is

    Lower Ground Floor, 20 Meridian Place, Clifton, Bristol, BS8 1JL

    Phone numbers etc remain the same (quite how BT managed this without getting something wrong we will never know!).

  • Views caching

    A little while ago I blogged about views content cache as a way to increase performance of your Drupal site. Today I released version 2.2 of the module, that adds lots of lovely features.

  • Page manager redirect

    Quite often you need to redirect a particular path on a Drupal site, there are a number of ways to do this, but most involve writing PHP code. Also, it's not hugely easy to do things like redirect node/%node but only when %node is a 'image' node, posted on a Tuesday. The awesome Page manager module, and a little utility module we wrote changes that.

  • Views content cache

    Views is awesome. You get a ton of flexibility and power, but that comes at a price: Some of the queries that views produces are less than optimal, and the rendering of results can take a long time. Views 2.6 introduced a nice solution to some of the issues, with the introduction of caching plugins.

    Views itself comes with a single cache plugin (okay, okay two if you're really counting) that is time-based. So you can say: "I don't care if I show content that's 6 hours old" and it'll handle it fine. I've been thinking for a while that there should really be a better way, if you've got a view listing blog posts, you only really need to flush the cache on that view when a new blog post is added, or and existing one is updated or deleted. After a client really needed this, I looked into it and found some code lying around in the views issue queue written by huesforalice. I cleaned it up some and created a module, presenting:

    Views content cache.

Pages

Subscribe to our RSS feed Subscribe to Drupal code