本文整理匯總了PHP中Paginator::get_pages_in_range方法的典型用法代碼示例。如果您正苦於以下問題:PHP Paginator::get_pages_in_range方法的具體用法?PHP Paginator::get_pages_in_range怎麽用?PHP Paginator::get_pages_in_range使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Paginator
的用法示例。
在下文中一共展示了Paginator::get_pages_in_range方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_pages
/**
* Returns an array of "local" pages given a page number and range.
*
* @param Paginator $paginator
* @param integer $page_range Unused
* @return array
*/
public function get_pages(Paginator $paginator, $page_range = null)
{
$page_range = $paginator->get_page_range();
$page_number = $paginator->get_current_page_number();
$delta = $page_number % $page_range;
if ($delta == 0) {
$delta = $page_range;
}
$offset = $page_number - $delta;
$lower_bound = $offset + 1;
$upper_bound = $offset + $page_range;
return $paginator->get_pages_in_range($lower_bound, $upper_bound);
}
示例2: get_pages
/**
* Returns an array of all pages given a page number and range.
*
* @param Paginator $paginator
* @param integer $page_range Unused
* @return array
*/
public function get_pages(Paginator $paginator, $page_range = null)
{
return $paginator->get_pages_in_range(1, $paginator->count());
}