当前位置: 首页>>代码示例>>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;未经允许,请勿转载。