本文整理匯總了PHP中DataMapper::get_paged方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataMapper::get_paged方法的具體用法?PHP DataMapper::get_paged怎麽用?PHP DataMapper::get_paged使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DataMapper
的用法示例。
在下文中一共展示了DataMapper::get_paged方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: mdi_get_paged
public function mdi_get_paged($page = 1, $page_size = 50, $paginator_size = 10, $page_num_by_rows = FALSE, $info_object = 'paged', $iterated = FALSE)
{
parent::get_paged($page, $page_size, $page_num_by_rows, $info_object, $iterated);
$paginator = array();
$paginator_current_index = ($page - 1) % $paginator_size;
$paginator_begin = $page - $paginator_current_index;
$total_pages = $this->{$info_object}->total_pages;
for ($i = 0; $i < $paginator_size; ++$i) {
if ($paginator_begin + $i > $total_pages) {
break;
}
$attribute = array();
if ($i == 0) {
$attribute['begin'] = TRUE;
}
if ($i == $paginator_size - 1) {
$attribute['end'] = TRUE;
}
if ($paginator_begin + $i == 1) {
$attribute['first'] = TRUE;
}
if ($paginator_begin + $i == $total_pages) {
$attribute['last'] = TRUE;
}
if ($i == $paginator_current_index) {
$attribute['current'] = TRUE;
}
$paginator[$paginator_begin + $i] = $attribute;
}
$this->{$info_object}->paginator = $paginator;
return $this;
}