Reputation:
i've just come across php-mobile-detect and i want to add it to my site. so far my current code is.
<?php
include("Mobile_Detect.php");
$detect = new Mobile_Detect();
?>
<?php if($detect->isiPad()) {
echo '<link rel="stylesheet" href="test.css" type="text/css">';
}
?>
This is working fine when i go on the ipad it shows the css, now what i want todo is add all iPhones, android devices, blackberry's etc to one css and any other desktop version to another css?
I know i'm close but i can't quite get there.
Upvotes: 0
Views: 611
Reputation: 1295
This should work your you:
<?php
include("Mobile_Detect.php");
$detect = new Mobile_Detect();
if ($detect->isMobile()) {
echo 'mobile';
}else{
echo 'desktop';
}
?>
Upvotes: 2