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...