DrupalCon Denver 2012

The in-US Drupal Convention this year was held in the beautiful mile-high city of Denver, Colorado. This was only my second convention, so I was by and large an observer. I listened to some excellent sessions, particularly “Tame the Burrito” by Jeff Eaton, “Using Sass & Compass in Drupal Theming” by Nathan Smith and Matt Farina, and “Drupal 8 Meets Symfony2″ by Fabien Potencier.

I got to talk with Ken Rickard of Palantir and Matt Butcher of HP. Luckily, Matt has been working on an interesting project called QueryPath that may help my University’s migration from a static HTML site (with over 90,000 pages) to Drupal.

Since we arrived earlier and departed later, I took the opportunity to take pictures around the many gorgeous locations Colorado has to offer. We went as far as Colorado Springs and Estes Park.

See my updated photostream from the trip: http://www.flickr.com/photos/dwieeb/

Pass Foreach Variables by Reference (PHP)

A recent trick I discovered while working on a Drupal module is the ability to pass the array element into a foreach loop by reference. Like so:

$array = array(1, 2, 3, 4, 5);

foreach ($array as &$element) {
  if ($element == 3)
    $element = 6;


Your output would be:

    [0] => 1
    [1] => 2
    [2] => 6
    [3] => 4
    [4] => 5

Not only does this save on memory, it also allows you to change the actual items in the array. Quite useful.

Another example:

$array = array(
  'cow' => 'moo',
  'pig' => 'oink',
  'cat' => 'meow',

foreach ($array as $key => &$element) {
  if ($key == 'cat')
    $element = 'bark!';



    [cow] => moo
    [pig] => oink
    [cat] => bark!

New WordPress Plugin: ScrollTo Top

Today I squeezed out a little plugin that will show a go-to-top icon in the corner of the page. When clicked, it will smoothly scroll the user’s browser to the top of the page using Ariel Flesler‘s ScrollTo jQuery plugin. The plugin comes with a few options to tweak it, like choosing or uploading your own icon, where the icon appears, etc.

I have yet to write a showcase page for it on this website, but you check out the plugin page on WordPress.org and download now: http://wordpress.org/extend/plugins/scrollto-top/

Specific Files 1.3 Released

The major change in this new version is the ability to apply Specific Files to all post types (including custom post types) or just apply it to posts and pages like it was originally made to do.

I have also relocated the Specific Files file directory to /wp-content/specific-files, where it should be easier to maintain (rather than copying the file directory into a temporary location while the plugin updates and when it finishes updating to copy it all back again). Because of this change, I have removed the available downloads of previous versions. I’m still rather new to how to handle plugin upgrades and I’m sure a few of you have gotten errors while trying to upgrade this plugin. For that I am sorry. I’ll get better at this stuff.

So – that’s my announcement. Download now! http://wordpress.org/extend/plugins/specific-files-for-posts-and-pages/