Book Image

Drupal 7 Mobile Web Development Beginner's Guide

By : Tom Stovall
Book Image

Drupal 7 Mobile Web Development Beginner's Guide

By: Tom Stovall

Overview of this book

<p>How disappointing is it to log on to a website for a product or business you love only to discover the feature you were drawn to doesn’t work on your mobile or tablet? Drupal has brand new features to adapt your existing site into a mobile site that will keep your customers coming back.</p> <p>The Drupal Mobile Web Development Beginner's Guide follows a humble 'Mom &amp; Pop' restaurant website which gets a makeover complete with cutting edge features that play to mobile, tablet and desktop audiences. By following the fun example, you will finish the book having effortlessly adapted your website so that it is accessible and, more importantly, looks good and functions well, on any mobile device.</p> <p>Restaurant websites are notoriously horrible to navigate and our Mom &amp; Pop example is wellintentioned but no exception to this rule. We bring this site out of the early 1990's with cutting edge development practices and a team development workflow. This pizza chain goes mobile with location services, audio, video, charting and mapping worthy of any multi-million dollar site. Each chapter examines the way the site works and shows you how to move the existing content and functionality into reusable features.</p>
Table of Contents (18 chapters)
Drupal 7 Mobile Web Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Pop quiz Answers

Preface

It's not an overstatement to say that handhelds have changed the world. What was, just 10 years ago, simply a phone is now the center of your online life and, for many users, their primary Internet device. The power of the smart phone is shaking up the world from Main Street and Wall Street to Pennsylvania Avenue and Downing Street.

Drupal is the perfect platform on which to build a mobile strategy. The power of millions of developers world-wide ensures that there's no problem you face that has not already been overcome by multiple developers and solved with any one of the hundreds of thousands of Drupal contributed projects.

What this book covers

Chapter 1, When is a Phone Not a Phone?, explains what we mean when we say "mobile." In this chapter, we'll take a look at the mobile platforms in use today and how they behave and render today's HTML standards.

Chapter 2, Setting up a Local Development Environment, teaches you to work in a team environment with version control and to create a local version of our site on Windows or Mac OS with Drush, Drush Make and a make file, and our standard open source PHP *AMP stack. It outlines a team workflow of building the code locally and pushing it to the live site.

Chapter 3, Selecting the Right Domain for your Mobile Site, guides you through setting up the Domain Access and Drupal Behaviors modules that redirect mobile and desktop browsers to the version of the website most appropriate for their client. In this chapter, we will learn to share content across sites without resorting to a multisite install.

Chapter 4, Introduction to a Theme, introduces the idea of progressive enhancement with CSS. In this chapter, we'll create a very simple HTML5 theme that will serve mobile clients with CSS Media Queries until a highly customized one can be devised.

Chapter 5, A Home with a View, demonstates the use of Context and Image Styles to create a customized view for the home page. In this chapter, we'll create a mobile-friendly menu and bundle it up into a feature that can push the new content to your live site in one fell swoop.

Chapter 6, The Elephant in the Room: Audio, Video, and Flash Media, teaches you to create a compelling audio and video experience without using Flash. It teaches you to create data visualization using data we've pulled from a View and the HighCharts JavaScript library.

Chapter 7, Location, Location, Location helps you to set up location services and cover some common use cases, as well as some uncommon ones using GMap, Location, Open Layers and Map Box.

Chapter 8, Services with a Smile, explores the Services module which serves up pieces of node content from a REST and/or SOAP API. In this chapter, we will leverage this module to add some interesting interactivity to our example site.

Chapter 9, Putting it Together, guides you in addding some advanced theming to your site and making the site more responsive to the various devices that will be accessing it.

Chapter 10, Tabula Rasa: Nurturing your site for tablets, explores the emerging tablet market and covers special design considerations and conventions for designing for tablet use.

Chapter 11, A Home in the Clouds, explores team deployment solutions such as Hudson/Jenkins, Features integration hooks and breaks down the go-live process to something that's repeatable and, with any luck at all, scriptable.

Appendix A, Pop Quiz Answers, contains the answers to all the pop quiz questions for all the chapters.

What you need for this book

You'll need a Mac or PC to develop your website. Optionally, you might want to get an Amazon AWS account for the chapter on deployment.

Who this book is for

This book is for the aspiring website developer as well as more experienced developers.

Conventions

In this book, you will find several headings appearing frequently. To give clear instructions of how to complete a procedure or task, we use:

Time for action — heading

  1. 1. Action 1

  2. 2. Action 2

  3. 3. Action 3

Instructions often need some extra explanation so that they make sense, so they are followed with:

What just happened?

This heading explains the working of tasks or instructions that you have just completed.

You will also find some other learning aids in the book, including:

Pop quiz — heading

These are short multiple choice questions intended to help you test your own understanding.

Have a go hero — heading

These set practical challenges and give you ideas for experimenting with what you have learned.

You will also find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "Go to http://developer.java.com and search for the JDK developer download. It will be a .exe file. Run the installer "

A block of code is set as follows:

<VirtualHost *:80>
ServerName dpk.local
DocumentRoot "C:\cygwin\home\[YOUR USER NAME]\sites\dpk"
<Directory "C:\cygwin\home\[YOUR USER NAME]\sites\dpk">
Options Includes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

core = "7.x"

dependencies[] = "context"

dependencies[] = "views"
description = "Home page view"

features[context][] = "Home Page"
features[ctools][] = "context:context:3"

features[ctools][] = "views:views_default:3.0"
features[views_view][] = "home"
name = "Drupallos Homepage"

Any command-line input or output is written as follows:

cd ~/Sites
git clone git://github.com/drupal4mobile/dpk.git

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "We then need to create an Android Virtual Device. Click on the Virtual devices tab and then click on the New button".

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to, and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

The code for this book is stored on GitHub at http://github.com/drupal4mobile/dpk and we'll use the GIT version control system throughout the book. I've organized the code for each chapter into a branch on GitHub. As this code is progressive from beginning to end, you can obtain the code for each chapter by checking out the GIT branch for that chapter. Feel free to fork any code on the repository and use it as you see fit. Any code in this book should be considered open source and released under the same license as Drupal.

After this book's publication I will attempt to take some of the custom modules used in the book to Drupal contrib module status. If I am successful, I will note such a change in the dpk.make file in the root of the install directory.

Also, you can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.