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

Time for action — redirection with a cookie to remember state


So many times, when you make a choice or preference on the website, you return to the website only to discover that the preference is lost. If you prefer one version of the website to another and make that preference known by choosing, the website should store your choice in a cookie and remember it when you come back. We are going to implement this in Drupal:

  1. 1. Edit the sites/default/settings.php file. Search for cookie_domain. Uncomment it out by deleting the # character at the start of the line and change the cookie_domain value to dpk.local:

    $cookie_domain = "dpk.local"
    
  2. 2. Edit the template.php of both sites, adding the highlighted lines to the dpk_mobile_preprocess_html function:

    function dpk_mobile_preprocess_html(&$vars) {
    global $cookie_domain;
    drupal_add_library("system", "jquery.cookie");
    drupal_add_js(array("cookie_domain" => $cookie_domain), "setting");
    if (module_exists('rdf')) {
    $vars['doctype'] = '<!DOCTYPE...