cayucostom wrote:
The PHP code is here but it would be great if someone in the forums with the necessary expertise would outline exactly how to use PHP with VSD or the CCHTML Editor. For example how to call if from HTML What exactly needs to be in the PHP and where to locate the PHP on the server. Where is Fe Pixie when we need her?
Cayucostom
Cheryl Davidson wrote:
I am adding my vote for a mobile website designer. The code is available for redirecting mobile browsers to mobile pages -- it helps to know a little php to use it though. I have not yet figured it out. The code can be found at http://detectmobilebrowsers.mobi/
I am adding my vote for a mobile website designer. The code is available for redirecting mobile browsers to mobile pages -- it helps to know a little php to use it though. I have not yet figured it out. The code can be found at http://detectmobilebrowsers.mobi/
The PHP code is here but it would be great if someone in the forums with the necessary expertise would outline exactly how to use PHP with VSD or the CCHTML Editor. For example how to call if from HTML What exactly needs to be in the PHP and where to locate the PHP on the server. Where is Fe Pixie when we need her?
Cayucostom
righto - now bad news all you VSD users - the first step of getting php code to go in your page is to save the file the code will go in as a .php file - and thats going to mess up VSD.... so - move along to the html editor...
I havent downloaded an investigated your script there Cheryl - i've just written a short example script for you...
to make ANY php go in your page - it has to be saved with a .php extension - so if you are goin to put your mobi redirect on your index page - first rename it from index.html to index.php (being renamed as a php file wont affect any of your html in the page - that will still run just the same)
once you've saved as a .php page - we need to insert some php...
this needs to go at the very top of your page - BEFORE any of the other code... (including the opening doctype tag even) Nothing at all should be before the code - not even a blank line
it needs to go up there because we dont want to output anything before we call a redirect to a mobi format page if they're using a mobi device...
<?
$ua = $_SERVER['HTTP_USER_AGENT'];
if (
stristr($ua, "Windows CE") or
stristr($ua, "AvantGo") or
stristr($ua, "Mobile") or
stristr($ua,"Syncalot") or
stristr($ua,"Mazingo") or
stristr($ua, "T68") or
stristr($ua, "Blazer") ) {
$device="MOBILE";
}
if (isset($device) and $device=="MOBILE") {
$location='mobile/index.php';
header ('Location: '.$location);
exit;
}
?>
Yup - thats it...
the line that says
$location='mobile/index.php';
can be changed to aim at the page you have made for mobi devices
the script asks the server what useragent the visitor is using (which browser)
checks if its in its list of mobi browsers
and if it is - it redirects to a different page
there are lots and lots of other useragents that are used by mobile devices. This script will catch and redirect a lot of them, but not all. And more are added all the time.
You can find more info about all the different mobi ua's here:
http://wurfl.sourceforge.net/
enjoy

Have fun
~ Fe Pixie ~
~ Fe Pixie ~