1
在WordPress中开发一个插件,并且很好,但是插件页面的分页卡住了。下面是从互联网下载我的代码(有从这里参考)WordPress:在插件设置页面分页时遇到问题
$items = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $wpdb->review_media GROUP BY post_id")); // number of total rows in the database
//测试,并得到了结果评价 的print_r($项目); //说这是输出值2 echo $ rm_options ['list_per_page']; //这是我的选择设定值1
if($items > 0) {
$p = new pagination;
$p->items($items);
$p->limit(empty($rm_options['list_per_page']) ? 20 : $rm_options['list_per_page']); // Limit entries per page
$p->target("admin.php?page=moderate.php");
$p->currentPage($_GET[$p->paging]); // Gets and validates the current page
$p->calculate(); // Calculates what to show
$p->parameterName('paging');
$p->adjacents(1); //No. of page away from the current page
if(!isset($_GET['paging'])) {
$p->page = 1;
} else {
$p->page = $_GET['paging'];
}
//Query for limit paging
$limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
} else {
echo "No Record Found";
}
当我通过POST_ID不组我的查询它工作正常,但只要我的分组行为怪异。它创建一个分页链接并获得空白页面。我认为原因在于将该行分组。但不知道如何解决这个问题。
这里是我的表截图
非常感谢您的帮助...
我不知道类,它不在你的问题,但我认为这里有一个错误:'$ p-> currentPage($ _GET [$ p-> paging])''。我想它应该是'$ p-> currentPage($ _GET ['paging'])' – 2013-02-24 10:32:55
没有它的不工作。班级,你可以在这里找到http://mis-algoritmos.com/2007/05/27/digg-style-pagination-class – 2013-02-24 10:36:28