0

我正在建立一个站点(您可以在此处找到)并在此站点上有一个类别列表。

该页面上的每个类别都链接到我的数据库中的一个项目。单击后会显示更多内容。

我在同一个数据库中有一个单独的数据库表单,称为应用程序(而不是 mobi)。在这里面我有一个可用的应用程序列表,但有些应用程序适用于选定的设备。

例如,某些应用程序链接到 google play,并且只能在 android 设备上显示,因为在另一台设备(例如 ios)上显示这些应用程序可能被视为毫无意义。

在 iPhone 和 android 上显示 iPad 应用程序也是如此,因为这些可以被视为毫无意义。

该设备保存在“设备”字段下的我的应用程序数据库中,并具有以下类别之一 iPhone iPad 或 android,

我想要的是在我的索引页面上显示一个类别,旁边是我的其他显示“APP DOWNLOADS”的类别。一旦点击它只会显示可用的相关应用程序,就像我当前在我的网站上的促销活动一样。

但我只希望链接出现在以下设备之一上:iPod touch、iPhone、iPad mini、iPad、android,因为这些是我目前唯一拥有内容的设备。例如。如果您在黑莓或 Windows 8 甚至 Firefox 手机上查看,则不会显示此类别。

请问有人能告诉我怎么做吗?

谢谢你。

我的索引页代码是:

<?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 as $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>

请帮忙。谢谢你。

4

1 回答 1

1

排序。

使用此代码:

<?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>

请1up。谢谢你。

于 2013-09-04T15:32:02.480 回答