Drupal

Learn how to use the command line toolkit Terminus to make deployments of Drupal, WordPress, and Backdrop sites on Pantheon faster and easier.

Blog Categories: 

I've recently needed to run a Node.js service alongside a Drupal 7 site to allow for a live-chat style of commenting. None of the current ecosystem of Drupal-integrated chat modules looked good for this particular website, but by greatly simplifying the comments UI and displaying it alongside a live video broadcast, we got something pretty good.

Blog Categories: 
Tags: 

Drupal has a very flexible taxonomy system for tagging and categorization content (and users, and anything else). This flexibility is one of its interesting differentiating features — you can create as many dimensions of categorization and tagging as you like, which is very attractive for librarians and other enthusiasts of organization. To keep that flexibility from totally bogging down the system, Drupal maintains an index table that maps those terms onto the pieces of content to which they're attached.

Blog Categories: 
Tags: 

I've recently needed to work with memcached on my MAMP setup. Normally for something like this, I'd consider setting up a Vagrant box and get the whole environment mirrored, but I wanted to see how hard it would be to make it work this way. Generally, it's not very difficult, but there are a couple snags you might run into.

Blog Categories: 

Out of the box, Drupal 7 does not have autosave capabilities. The complexity of the kinds of content you can create is probably the reason for this, but that doesn't change the fact that it's a bummer. There are efforts underway to change this for Drupal 8; whether they will actually make it in is another question.

Blog Categories: 

Every year there are two huge Drupal conferences: one in North America, the other somewhere else in the world. North America's was in Austin this year, and just wrapped up. The next one will be in Amsterdam at the end of September. It's a tradition at each con to announce the location of the next one, and next year's will be here in Los Angeles. Yay! I've been to many camps, but never to a con, so this gives me absolutely no way out of finally going. I'm definitely looking forward to this.

I found out about this very shortly before Austin, and helped some of the fine folks in LA's Drupal community put together a video that played during the closing session in Austin, revealing our fair city as the next location. I worked on the music for it, sourcing some material and playing a little bit of ukulele. Check it out!

Blog Categories: 
Tags: 

When you change themes on a Drupal 7 site, you often need to reset the placement of your blocks. If you're using the core block module to place them, you may end up with a bunch of blocks in unexpected places on your new theme. If you want to reset everything and start from scratch, you could edit the {blocks} table in your database, but you can also do it with JavaScript. While viewing the blocks admin page (admin/structure/blocks), paste this line into your JavaScript console:

jQuery('#blocks').find('select').val(-1);

If you're trying to make your Drupal site as fast as possible, you might consider using a static HTML file for page not found (404) errors. There are various other solutions that can help make Drupal faster in these situations while still letting you take advantage of Drupal-level redirects and whatnot, but a static page is always the fastest.

Blog Categories: 
Tags: 

Update: I've added a patch for Drupal 7 that addresses a similar issue for the core node module. Take a look if you're interested.

Blog Categories: 
Tags: 

I'm working on a Drupal project that requires calculating some custom stats for each registered user. To get it working, I ran my SQL queries right in hook_user_load(), which is wildly inefficient; it's much better to run the queries once and cache the results for a while. Drupal has nice cache functions built-in, and I thought I should use them, but wasn't totally clear on how to do it based on the documentation.

Jeff Eaton of Lullabot wrote a really helpful article on how to do basic caching in Drupal 7, which is a good introduction, but didn't really explain how to cache a bunch of related, but separately calculated, pieces of data using a function you'd call repeatedly. Examples module is also great, and does include a cache_example module, but also didn't have an example that was right up my alley.

So, here's how to write a single function that can be called multiple times on the same kind of object. This is not what you'd want to do for users or other built-in entities (for those, you should use Entity Cache module). Thanks to Planet Drupal readers for the feedback and help clarifying this.

Blog Categories: 
Tags: 

Pages

Subscribe to RSS - Drupal