Php Infinate在平板电脑上滚动,同时使用Json提取内容
我使用scrollExtend插件调用一个Json脚本,它将吐出我的内容。 这在台式机上运行良好,但我的网站响应迅速,我也需要这项功能在平板电脑和移动设备上运行 我进行了大量测试,并将测试范围缩小到Json脚本:Php Infinate在平板电脑上滚动,同时使用Json提取内容,php,jquery,json,tablet,Php,Jquery,Json,Tablet,我使用scrollExtend插件调用一个Json脚本,它将吐出我的内容。 这在台式机上运行良好,但我的网站响应迅速,我也需要这项功能在平板电脑和移动设备上运行 我进行了大量测试,并将测试范围缩小到Json脚本: <?php $parent_query = bb_query("SELECT f_children FROM t_articles WHERE f_id= '85' and (f_removed IS NULL or f_remo
<?php
$parent_query = bb_query("SELECT f_children
FROM t_articles
WHERE f_id= '85' and (f_removed IS NULL or f_removed ='0')
");
$parent_row = bb_fetch_assoc($parent_query);
$children = explode(':',$parent_row['f_children']);
$i= 1;
$rowsperpage = 6;
$totalpages = count($children);
$_SESSION['highlights_current_page']++;
if (isset($_SESSION['highlights_current_page']) && is_numeric($_SESSION['highlights_current_page'])) {
$currentpage = (int) $_SESSION['highlights_current_page'];
}
if ($currentpage > $totalpages) {$currentpage = $totalpages;}
if ($currentpage < 1) {$currentpage = 1;}
$offset = ($currentpage-1) * $rowsperpage;
$x=0;
##take off earlier articles
while($x < $offset){
array_shift($children);
$x++;
}
##take off later articles
$children = array_slice($children, 0, $rowsperpage);
echo $_SESSION['highlights_current_page'];
echo "current:".$currentpage;
echo "total:".$totalpages;
echo "offset:".$offset;
foreach($children as $child)
{
$child_query = bb_query("
SELECT *
FROM t_articles
WHERE f_id = {$child}
and (f_removed IS NULL or f_removed ='0')
AND f_live ='1'
");
while ($row = bb_fetch_assoc($child_query)){
//data for echoing the articles
}
}
?>