當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Paginator::get_current_page_number方法代碼示例

本文整理匯總了PHP中Paginator::get_current_page_number方法的典型用法代碼示例。如果您正苦於以下問題:PHP Paginator::get_current_page_number方法的具體用法?PHP Paginator::get_current_page_number怎麽用?PHP Paginator::get_current_page_number使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Paginator的用法示例。


在下文中一共展示了Paginator::get_current_page_number方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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);
 }
開發者ID:EhteshamMehmood,項目名稱:BlogMVC,代碼行數:20,代碼來源:Jumping.php

示例2: 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();
     $original_page_range = $page_range;
     $page_range = $page_range * 2 - 1;
     if ($original_page_range + $page_number - 1 < $page_range) {
         $page_range = $original_page_range + $page_number - 1;
     } else {
         if ($original_page_range + $page_number - 1 > count($paginator)) {
             $page_range = $original_page_range + count($paginator) - $page_number;
         }
     }
     return parent::get_pages($paginator, $page_range);
 }
開發者ID:DavBfr,項目名稱:BlogMVC,代碼行數:22,代碼來源:Elastic.php

示例3: get_pages

 /**
  * Returns an array of "local" pages given a page number and range.
  *
  * @param  Paginator $paginator
  * @param  integer $page_range (Optional) Page range
  * @return array
  */
 public function get_pages(Paginator $paginator, $page_range = null)
 {
     if ($page_range === null) {
         $page_range = $paginator->get_page_range();
     }
     $page_number = $paginator->get_current_page_number();
     $page_count = count($paginator);
     if ($page_range > $page_count) {
         $page_range = $page_count;
     }
     $delta = ceil($page_range / 2);
     if ($page_number - $delta > $page_count - $page_range) {
         $lower_bound = $page_count - $page_range + 1;
         $upper_bound = $page_count;
     } else {
         if ($page_number - $delta < 0) {
             $delta = $page_number;
         }
         $offset = $page_number - $delta;
         $lower_bound = $offset + 1;
         $upper_bound = $offset + $page_range;
     }
     return $paginator->get_pages_in_range($lower_bound, $upper_bound);
 }
開發者ID:DavBfr,項目名稱:BlogMVC,代碼行數:31,代碼來源:Sliding.php


注:本文中的Paginator::get_current_page_number方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。