isMobile(); //returns 0 or 1 } //OK, we're done. We know which version we want so let's return it if (!$display_mode_changed)header("Cache-Control: max-age=" . $maxage); // Set cache control before we go any further else { //force a quicker refresh of (only) the current page after the visitor has changed the display mode manually: header("Expires: ".gmdate("D, d M Y H:i:s")." GMT"); // Always expired header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");// always modified header("Cache-Control: no-cache, must-revalidate, max-age=0");// HTTP/1.1 header("Pragma: nocache");// HTTP/1.0 header("Cache-Control: max-age=0"); //force refresh of this page } $current_file = pathinfo($file); $full_path = $base . $current_file['basename']; function echoDesk($text) { global $mobile_browser; if ($mobile_browser == 0 ) { echo $text; } } function echoMobile($text) { global $mobile_browser; if ($mobile_browser > 0 ) { echo $text; } } function echoSwitch ($desktoptext, $mobiletext) { global $mobile_browser; if ($mobile_browser > 0 ) { echo $mobiletext; } else echo $desktoptext; }