Привет))подскажи куда именно вписать код,в какой файл?зарание спасиба
Чтоб много не писать, можно добавить функцию
function mobile_detect() {
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$ipod = strpos($user_agent,"iPod"
$iphone = strpos($user_agent,"iPhone"
$android = strpos($user_agent,"Android"
$symb = strpos($user_agent,"Symbian"
$winphone = strpos($user_agent,"WindowsPhone"
$wp7 = strpos($user_agent,"WP7"
$wp8 = strpos($user_agent,"WP8"
$operam = strpos($user_agent,"Opera M"
$palm = strpos($user_agent,"webOS"
$berry = strpos($user_agent,"BlackBerry"
$mobile = strpos($user_agent,"Mobile"
$htc = strpos($user_agent,"HTC_"
$fennec = strpos($user_agent,"Fennec/"
if ($ipod || $iphone || $android || $symb || $winphone || $wp7 || $wp8 || $operam || $palm || $berry || $mobile || $htc || $fennec) {
return true;
} else {
return false;
}
}
Код для страниц:
if (mobile_detect()) {
echo '
для мобилок
';
} else {
echo '
для компов
';
}