Let's imagine a scenario where you need to display some data from a remote service to the user. Instagram, for example. You want to grab the 6 most recent posts, pass them through some theming, then output them into a block. How would you go about doing that? In Drupal 7, one possible approach might look like this.
Autoloading of PHP classes was introduced in Drupal 7. Through a mechanism known as "the registry", modules were able to specify the files that contained their class definitions, then simply use the classes without needing a require or include statement. This system definitely isn't perfect... Having a database backed registry caused a lot of queries for modules like Views that instantiate a lot of classes. It also required a cache clear to pick up any caches, and forced developers to maintain an explicit list of their classes, which then had to be parsed and scanned each time caches were cleared.
Meanwhile, in the broader PHP world, a system known as PSR-0 was conceived. PSR-0 is able to autoload classes with minimal explicit registration, and has no dependency on the database. Because it is a PHP standard (rather than a Drupal specific standard), you can also count on broad support for your favorite external libraries.
This article is a followup to Creating Tokens in Drupal 6. Part of the token module was moved into core for Drupal 7, meaning it is even easier to create and use tokens programatically. I'm going to walk through how to use tokens programatically in Drupal 7, both using existing tokens and creating new ones.
I recently made the switch from Hostgator Shared hosting to a Linode instance, and WOW. It's amazing what you can do with a single (relatively small) box dedicated to serving up a single site. Without any further ado, I want to share some tips I gathered from setting the server up, and some benchmark results from along the way.
One of the additions to Drupal 7 that went in without a lot of fanfare was the Queue API. The Queue API is designed to manage tasks. It's very similar to the way we make to-do lists for household chores. If you have a hundred things to do in a day, you need to write them down and cross them off the list as you do them. Otherwise you lose track of what's left.
Want interactive table filtering without requiring ajax page reloads? I needed this last week and couldn't find a simple, easy to use jQuery table filter that would give me select boxes in the table header. This seems like a no-brainer, and I'm sure a similar plugin exists somewhere in the jQuery universe, but I couldn't find it, so I wrote one.
If there's one thing I've learned about upgrading Drupal sites, it's that you're going to have to do the same 50 steps over and over and over again to fix things as they fail. It's awful, tedious work. Luckily, Drush now has "drush site-upgrade," which makes things considerably easier. Still it ignores a couple of the really fundamental things like making sure your existing Drupal 6 site is up to date before it starts, and copying the files directory over to your new site. So I wrote a shell script to do all of this for me.
With the rise of web applications, the web browser is being used for stuff that used to take a complex piece of software on the local computer. For example, UberPOS is a project I've been working on recently that brings a point-of sale cash register to any computer capable of connecting to the internet.