Last active
October 19, 2016 11:44
-
-
Save bwente/8928442 to your computer and use it in GitHub Desktop.
MODx snippet. It displays the download link for the mobile device you are using.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//$iOS_chunk = $modx->getOption('ios',$scriptProperties); | |
//$Android_chunk = $modx->getOption('droid',$scriptProperties); | |
$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod"); | |
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone"); | |
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad"); | |
$Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android"); | |
//check if user is using ipod, iphone or ipad... | |
if( $iPod || $iPhone || $iPad ){ | |
$output = $modx->getChunk($scriptProperties['ios']); | |
}else if($Android){ | |
$output = $modx->getChunk($scriptProperties['droid']); | |
} | |
return $output; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment