fromAugust 2011
Article:

Drupal Mobile Website Development Book Available

2

The number of people who access the Web using mobile devices—such as smartphones and tablets—is growing rapidly every day, to the extent that it has even exceeded the number who surf the Web using traditional platforms, such as laptops and desktop computers. Consequently, the websites we design and build must be made compatible with these new platforms if we hope to serve the needs of most visitors. For Drupal developers, themers, and website administrators, the first question that may come to mind is: What resources are available for learning how to create mobile-ready websites, requiring the minimum time and complexity for us, while resulting in the maximum device compatibility and aesthetic success for our visitors?

Mobile web development book coverGiven the tremendous interest in mobile Drupal websites, one might imagine that there would already be several books published on the subject. But remarkably, as of this writing (May 2011), there is only one! In April 2011, Wrox published a book written by James Pearce: (ISBN 978-0470889510). In this article, I examine the book from the perspective of a Drupal enthusiast. Because the book features two additional CMSs, one might assume that only a third of the book would be of interest to a Drupal programmer. But more than half the material is not specific to any CMS—and I found this CMS-neutral information to be of even greater value. Spanning 552 pages, the book's material is organized into five parts, of which the second and third are the most substantial in length and information.

The first five chapters—which form the first part of the book, "The World of the Mobile Web"—serve as an overview of the mobile Web itself, website development for mobile devices (as compared to the desktop), mobile technologies and networks, their technical limitations, recent developments in the mobile space, online information resources, and mobile browsers. The chapter that probably would be of most interest to Drupal developers is the fifth one, "The Mobile Toolbox," which covers various mobile development techniques, server-side technologies, and programming tools that are frequently chosen for building mobile-ready websites.

Readers conversant with the mobile world may be tempted to skip the first part of the book, and jump straight to the second, "General Mobile Techniques," which addresses mobile development independent of any particular CMS. The author introduces a wide range of topics relevant to mobile web development: navigation menu depth, breadth, grouping, and placement; typography, pagination, multimedia, and forms; CSS and JavaScript; and the entry points and structures of the desktop and mobile versions of the website, relative to one another. Next, readers begin learning how to perform browser detection and allow a site visitor to switch between mobile and desktop versions of the site. This is the first point in the book where readers encounter any significant amount of source code, most of which is a combination of PHP, XML, CSS, and HTTP user-agent fields in request headers. While not utilized by the majority of programmers (at least knowingly), patterns can help designers and coders leverage proven techniques, yet also learn technologies with which they are unfamiliar.

In Chapters 8 through 10, the author presents several user interface patterns utilized by the three featured CMSs (forms, content lists, image galleries, and comments), and explains how they could be applied to mobile websites. He also covers some critical design considerations—such as CSS media queries—and several HTML/CSS templates and libraries that could be valuable as starting points if one opted to not use a CMS plug-in. Sadly, there do not appear to be any Drupal contrib modules to control CSS media queries, possibly because it would require modifying html.tpl.php, and such settings would likely conflict with the themer's choices in the theme's .info file.

In the lengthiest part of the book, "Major CMS Platforms," the author shows how one could apply the aforesaid techniques to create mobile-ready websites based upon the three most popular CMSs (WordPress, Drupal, and Joomla). Developers who use Drupal exclusively will learn nothing of value from the first and third sections. The Drupal-specific chapters (13 and 14) first cover the basics, and then explore the two major relevant contrib modules: Mobile Plugin and Mobile Tools. The main blemish is that the author presents the Mobile Plugin module as a solution for both Drupal 6 and 7, but as of this writing there is no version of it for Drupal 7, and it is no longer being maintained. Readers could also become frustrated because the API calls in Chapter 14 do not work for Drupal 7 (released months before the book), although no mention is made that the code is intended only for Drupal 6.

The last part of the book, "Enhancing and Launching Your Site," may be of interest to Drupal programmers even though it uses WordPress as a framework because the author discusses how to use two JavaScript-based frameworks, jQuery Mobile and Sencha Touch. He also explores topics such as testing and debugging (using browser plug-ins, mobile emulators, and online testing services), as well as transcoders, traffic analysis, and mobile search and monetization. The final part of the book contains reference information, including some Drupal resources. Most of the example code shown in the book can be downloaded from the publisher's page.

As with any first edition of a technical work, this one has some flaws: Some of the example code could have been better crafted, e.g., using fieldsets for grouping input fields (instead of divs). Also, there are more than three dozen errata in just the first two thirds of the book. Fortunately, none of them obscure the intended meaning of the narrative or the value of the example source code. Overall, James Pearce's book is a contribution that should be welcomed by all Drupal mobile programmers—and not just because it's the only one currently available!

Comments

Drupal Mobile Web Development Beginner's Guide published in 2012 by Packt Publishing is also available. I found it very useful as a beginner to mobile (rather than to Drupal). It covers setting up a local development environment in Mac and Windows, using Domain Access, Context, Display, and Views to set up a mobile theme, media, geo, services, and more.

If we're going to post year-old articles fresh on the Drupal Planet, maybe some editing or a quick fact-check would be beneficial. There are several books out now on Drupal and mobile development, one even specific to Drupal 7. While I appreciate the fact that Drupal Watchdog is making these articles available online, it would be great for everyone reading these as new if they gave the authors a chance to make corrections or updates before publishing year-old articles.