To answer my own question, if using the browscap method as Vittorio posted and you want iphone customers to see the full site, then this is how i did it.
1. Create a new file called redirect.php and place it in the public_html folder
2. put the following code in it -changing the domain name to you own
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<?php
$value = 'full';
setcookie("TestCookie", $value);
setcookie("TestCookie", $value, time()+1800); /* expire in 1/2 hour */
?>
<head>
<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/">
</head>
</html>
3. On your site, put a link to the redirect.php file for users to click on to see the full site
4. Alter the code slightly that vittorio posted to look like this
Code:
* Determine if client is a mobile device or not ($mobile = 1 ==> it is | $mobile = 0 ==> it is not)
*/
$browser = get_browser($_SERVER['HTTP_USER_AGENT'], true);
$mobile = ($browser['ismobiledevice'] == null ? 0 : $browser['ismobiledevice']);
$platform = strtolower($browser['browser']);
/**
* Check if user wants full version or not use it
*/
$is_mobile = "true";
if(isset($_COOKIE['TestCookie'])){
$is_mobile = "false";
}
/**
* Check if there is a specific template for this mobile platform and use it
*/
if ($mobile == 1){
if ($is_mobile == "true"){
$exists_mobile = file_exists(DIR_WS_TEMPLATES . $template_dir . '_mobile');
$exists_platform = file_exists(DIR_WS_TEMPLATES . $template_dir . '_mobile_' . $platform);
if ($exists_platform) {
$template_dir .= '_mobile_' . $platform;
} else {
if ($exists_mobile) {
$template_dir .= '_mobile';
}
}
}
}
/**
* EOF : SPECIFIC TEMPLATE FOR MOBILE CLIENT
Hope this helps someone out with creating mobile based zen cart templates for iphones etc
Bookmarks