Blog

Adaptive Images and Drupal 7

Having adaptive images is an great addition to an responsive website. Not only will it reduce page load times, but it will make the site perform better on small devices with limited resources. But wouldn't it be nice if there was an easy way to integrate adaptive images in with your current Drupal site? And if you could pick as many images styles to generate the adapted images as you wanted? And if it was integrated with the Media module so you could insert adaption images using a wysiwyg editor? Read more about Adaptive Images and Drupal 7

jQuery Mobile with Drupal 7

A few months back I did a talk at DrupalCamp Montreal on using jQuery Mobile with Drupal. The message passed along during that talk was essentially, jQuery Mobile and stock Drupal 7 don't work together. It boils down to the version of jQuery that Drupal 7 ships with (1.4.4) is too old and doesn't work with the latest version of jQuery Mobile (which required jQuery 1.6.x or higher).

But that didn't stop our enterprising developers from finding a way to get jQuery Mobile and Drupal to play well together. We decided to tackle the three aspects holding Drupal and jQuery Mobile back from working together:

  1. Drupal Core compatible with jQuery 1.6.x and jQuery UI 1.8.x
  2. jQuery Mobile module to integrate the library
  3. jQuery Mobile compatible theme elements

Using bash "alias" with Drush to save on typing

Drush is great. In fact, I can't remember a time where I didn't use drush as a daily tool for managing and developing on Drupal. It saves so much time and effort from clicking through configuration windows in a browser and instead allows you to type out what you want directly.

But can we do better? Can we save even more time? We sure can!

If you're using bash in your terminal (which you most likely are) you can setup "alias" commands to shorten often used typed out commands. Read more about Using bash "alias" with Drush to save on typing

Learning Drupal 7 Entities

One of the biggest changes in Drupal 7 is the entity system. In Drupal terms "Entities are the new nodes". They are the "base class" if you will for defining types of data. Still, nodes remain the base for types of content. The distinction between "data" and "content" is subtle, but an important one. Read more about Learning Drupal 7 Entities

Scrollmarks: Using your browsers local storage

To try out the local storage API built into browsers, I wrote a small module that automatically saves your last scroll location on a page.

For example, say you're reading a long blog post and you have to leave for some reason. You close your browser and and your pages are gone. Next time you load that page, a little javascript runs to check for a scroll location in your local browser storage. If it finds a value, it will use window.scrollTo and put you back where you left off.

It's pretty simple, have a look at the code:

Read more about Scrollmarks: Using your browsers local storage

Tips on creating files and nodes remotely via the services module

Communicating with the Drupal services module can get rough for the uninitiated. While connecting and reading data is quite well documented and straightforward, creating and saving objects can sometimes mean a lot of trial and error.

Publishing content via the service module is done via the 'node.save' and 'file.save' method calls. They both take one argument, an object (though some documentation says array, they require an object), and both return the id of the node or file they create.

The while the documentation says that the node object for 'node.save' and the file object for 'file.save', this may not actually work in all cases. The methods 'node.save' and 'file.save' work by generating and submitting node or file creation form, filling it in with the data in the provided object. Since the form to create a node can be different than the node object it creates, valid node objects submitted to 'node.save' may not be created correctly. Read more about Tips on creating files and nodes remotely via the services module

Pages

Subscribe to