简体   繁体   English

Joomla Infinite Scrolling MySQL分页问题

[英]Joomla Infinite Scrolling mysql pagination issues

I have set up infinite scrolling on a Joomla based website to load db results from mysql query. 我已经在基于Joomla的网站上设置了无限滚动,以从mysql查询加载数据库结果。 It works fine but when I have it set up to load 10 results at a time, it skips results 11-20 and then loads the rest of the values, and likewise when I set up to show 20 results it loads the first 40 without any repeats, and then proceeds to load 10 previouss results and 10 new ones for each new pagination result until it reaches the end of the list. 它工作正常,但是当我设置一次加载10个结果时,它会跳过结果11-20,然后加载其余值,同样,当我设置显示20个结果时,它将加载前40个结果,而没有任何结果重复,然后继续为每个新的分页结果加载10个先前的结果和10个新的结果,直到到达列表的末尾。 Here is the code I have for pagination, 这是我用于分页的代码,

//
jimport('joomla.html.pagination');
// prepare the pagination values
$total = $this->xyz->getTotal('posts',' and cat_id = ' . $cat->cat_id);
$limit = $mainframe->getUserStateFromRequest('global.list.limit','limit', $mainframe->getCfg('list_limit'));
$limitstart = $mainframe->getUserStateFromRequest(JRequest::getVar('option').'limitstart','limitstart', 0);
$this->items = $this->xyz->categoryItems(JRequest::getInt('cat_id'),$limitstart,$limit);
// create the pagination object
$_pagination = new JPagination($total, $limitstart,$limit);
$_pagination_footer = $_pagination->getListFooter();
//

I should mention that I set the $limit value to 10 on line 7 of the code above to make it load 10 at a time. 我应该提到,我在上面代码的第7行将$ limit值设置为10,以使其一次加载10。 If it is left as $limit it loads 20 at a time. 如果将其保留为$ limit,则一次加载20。

Preferably I would like to load 50 at a time without any repeats or omissions but as it is now, I get plenty of repeats when set to 50. I found that setting it to 10 gives me the best results but still skips 11-20. 最好是一次加载50次,而没有任何重复或遗漏,但是现在,设置为50时我会得到很多重复。我发现将其设置为10可以得到最好的结果,但仍然跳过11-20。

Any suggestions or thoughts would be greatly appreciated. 任何建议或想法将不胜感激。

在两种不同的情况下也有类似的问题:1)SEF已关闭您可能要调试global.list.limit以检查其加载的值的一致性2)SEF已打开在相同的sef url的重定向库中查找不一致的条目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM