Book Image

RESS Essentials

Book Image

RESS Essentials

Overview of this book

RESS is a new methodology in the world of web design and development. It attempts to solve the problems that accompany the RWD (responsive web design) approach to web design. RESS is still in its infancy, but it is growing at an exponential rate. RESS Essentials shows you how to make server-side applications smarter and more aware of a visitor's environment limitations (device, screen size, and browser). This allows you to create faster and more reliable websites. Through this book, you will build a solid base of knowledge on RESS-related technologies, while the step-by-step tutorials will help you to create your own RESS system. This book is an introduction to RESS alchemy and gives you an incentive to build your own RESS lab. It will give you a broad overview of the multiple techniques used to code responsive websites in responsible ways. Beginning with an overview of RWD, you will learn the steps involved in setting up RWD for client-side development. You will then learn how to scale images using client- and server-side technology. By the end of this book, you will have learned about the implementation of RESS application patterns, browser feature detection, and various RESS architectures. RESS Essentials will also teach you how to use jQuery with some RWD design patterns and how to employ REST API for RWD pages.
Table of Contents (15 chapters)
RESS Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

WURFL plus screen size detection


We use the same framework setup for our test RESS applications as we did in the previous chapter with device detection libraries. You can find it in the directory ress_cookie_wurfl with the class Ress_Cookie_Wurfl in app.php. I added a generalized apploader to bootstrap.php. The Apploader (application loader) in this case is just a function in bootstrap.php that takes the module name as an argument and returns a module class instance. We can now get the Ress_Cookie_Wurfl class instance from my test page ress_cookie_wurfl.php with the following line of code:

$RESS_app1 = loadApp('ress_cookie_wurfl');

We start processing the request by checking if a cookie exists and if it does, we save this value to a class variable, as in the following code:

if (array_key_exists('screen_width', $_COOKIE)) {
  $cookie_screen_width = $_COOKIE['screen_width'];
  $this->screen_width = $cookie_screen_width;
  $this->cookie_exists = true;
}

If for some reason we don't have a...