Skip to content

Instantly share code, notes, and snippets.

@bwente
Last active October 19, 2016 11:44
Show Gist options
  • Save bwente/8928442 to your computer and use it in GitHub Desktop.
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.
<?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