php - Device specific content to be displayed -
i'm building site (which able find here) , have list of categories on site.
each category on page linked item in database. displays more content once clicked.
i have separate database form within same database called apps (instead of mobi). inside have list of apps available apps selected devices.
for example apps link google play , can displayed on android device displaying these on device (ios example) can seen pointless.
the same goes displaying ipad apps on iphone , on android these can seen pointless.
the device saved in apps database under field "device" , have 1 of these categories iphone ipad or android,
what display category on index page along side other ones "app downloads". , once clicked displays relevant apps available current promotions on site.
but want link appear if on 1 of these devices: ipod touch, iphone, ipad mini, ipad, android these devices have content @ moment. example. if viewing on blackberry or windows 8 or firefox phone category not show up.
please can tell me how this?
thank you.
my code index page is:
<?php include_once('include/connection.php'); include_once('include/article.php'); $category = new category; $articles = $category->fetch_all(); ?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr...nsitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>xclo.mobi</title> <link type="text/css" rel="stylesheet" href="other.css" /> <link rel="apple-touch-icon" href="homescreen.png" /> <link href="startup.png" rel="apple-touch-startup-image" /> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setaccount', 'ua-34172259-1']); _gaq.push(['_setdomainname', 'xclo.co.uk']); _gaq.push(['_trackpageview']); (function() { var ga = document.createelement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getelementsbytagname('script')[0]; s.parentnode.insertbefore(ga, s); })(); </script> </head> <body> <?php include_once('header.php'); ?> <div id="content"> <?php foreach ($articles $article) { ?> <ul class="pageitem"><li class="button"> <a href="list.php?id=<?php echo $article['promo_cat']; ?>"> <input type="submit" name="submit" value="<?php echo $article['promo_cat']; ?>"/> </a></li></ul> <?php } ?> </div> <br><center> <script charset="utf-8" type="text/javascript" src="http://ws-eu.amazon-...d9-6cf16307e855"> </script> <noscript><a href="http://ws-eu.amazon-...t">amazon.co.uk widgets</a></noscript></center> <?php include_once('footer.php'); ?> </body> </html>
please help. thank you.
sorted.
using code:
<?php $ua=$_server['http_user_agent']; switch(true) { case stripos($ua,'android') : $device = 'android'; break; case stripos($ua,'ipad') : $device = 'ipad'; break; case stripos($ua,'iphone') : $device = 'iphone'; break; } ?> <ul class="pageitem"><li class="button android"><input name="submit" value="app downloads" onclick="window.location='apps.php?id=<?php echo $device; ?>' " type="submit" /></li></ul>
please 1up. thank you.
Comments
Post a Comment