当前位置: 首页>>代码示例>>PHP>>正文


PHP Collection::lastPage方法代码示例

本文整理汇总了PHP中Collection::lastPage方法的典型用法代码示例。如果您正苦于以下问题:PHP Collection::lastPage方法的具体用法?PHP Collection::lastPage怎么用?PHP Collection::lastPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Collection的用法示例。


在下文中一共展示了Collection::lastPage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onRun

 public function onRun()
 {
     $this->prepareVars();
     $this->posts = $this->page['posts'] = $this->listPosts($this->property('slug'));
     /*
      * If the page number is not valid, redirect
      */
     if ($pageNumberParam = $this->paramName('pageNumber')) {
         $currentPage = $this->property('pageNumber');
         if ($currentPage > ($lastPage = $this->posts->lastPage()) && $currentPage > 1) {
             return Redirect::to($this->currentPageUrl([$pageNumberParam => $lastPage]));
         }
     }
 }
开发者ID:edhardie,项目名称:blog-plugin,代码行数:14,代码来源:ArchivePosts.php

示例2: onRun

 public function onRun()
 {
     $this->prepareVars();
     $this->category = $this->page['category'] = $this->loadCategory();
     $this->articles = $this->page['articles'] = $this->listArticles();
     /*
      * If the page number is not valid, redirect
      */
     if ($pageNumberParam = $this->paramName('pageNumber')) {
         $currentPage = $this->property('pageNumber');
         if ($currentPage > ($lastPage = $this->articles->lastPage()) && $currentPage > 1) {
             return Redirect::to($this->currentPageUrl([$pageNumberParam => $lastPage]));
         }
     }
 }
开发者ID:abnmt,项目名称:oc-theaterpress-plugin,代码行数:15,代码来源:Archive.php

示例3: onRun

 /**
  * @see RainLab\Blog\Components\Posts::onRun()
  * @return mixed
  */
 public function onRun()
 {
     $this->prepareVars();
     // map get request to :search param
     $searchTerm = Input::get('search');
     if (\Request::isMethod('get') && $searchTerm) {
         // add ?cats[] query string
         $cats = Input::get('cat');
         $query = http_build_query(['cat' => $cats]);
         $query = preg_replace('/%5B[0-9]+%5D/simU', '%5B%5D', $query);
         $query = !empty($query) ? '?' . $query : '';
         return Redirect::to($this->currentPageUrl([$this->searchParam => urlencode($searchTerm)]) . $query);
     }
     // load posts
     $this->posts = $this->page['posts'] = $this->listPosts();
     /*
      * If the page number is not valid, redirect
      */
     if ($pageNumberParam = $this->paramName('pageNumber')) {
         $currentPage = $this->property('pageNumber');
         if ($currentPage > ($lastPage = $this->posts->lastPage()) && $currentPage > 1) {
             return Redirect::to($this->currentPageUrl([$pageNumberParam => $lastPage]));
         }
     }
 }
开发者ID:ardani,项目名称:october-blogsearch-extension,代码行数:29,代码来源:SearchResult.php

示例4: onLoadPosts

 /**
  * Ajax pagination
  * @return array
  */
 public function onLoadPosts()
 {
     $this->prepareVars();
     $is_last = Input::get('page', 1) >= $this->posts->lastPage() ? true : false;
     $template = Input::get('template', $this->template);
     return ['is-last' => $is_last, 'posts' => $this->posts, '@.post-load' => $this->renderPartial('fieldPosts::ajax', ['posts' => $this->posts, 'template' => $template])];
 }
开发者ID:zrosiak,项目名称:fields,代码行数:11,代码来源:Posts.php

示例5: onRun

 public function onRun()
 {
     $this->prepareVars();
     /* $this->addCss('/plugins/zingabory/gallery/bower_components/photoswipe/dist/photoswipe.css');
        $this->addJs('/plugins/zingabory/gallery/bower_components/photoswipe/dist/photoswipe.min.js');
        $this->addJs('/plugins/zingabory/gallery/bower_components/photoswipe/dist/photoswipe-ui-default.min.js');*/
     $this->category = $this->page['category'] = $this->loadCategory();
     $this->galleries = $this->page['galleries'] = $this->listGalleries();
     /*
      * If the page number is not valid, redirect
      */
     if ($pageNumberParam = $this->paramName('pageNumber')) {
         $currentPage = $this->property('pageNumber');
         if ($currentPage > ($lastPage = $this->galleries->lastPage()) && $currentPage > 1) {
             return Redirect::to($this->currentPageUrl([$pageNumberParam => $lastPage]));
         }
     }
 }
开发者ID:andrijdavid,项目名称:octogallery,代码行数:18,代码来源:Galleries.php

示例6: onRun

 public function onRun()
 {
     $this->prepareVars();
     try {
         $this->category = $this->page['category'] = $this->loadCategory();
     } catch (ModelNotFoundException $e) {
         return App::make('Cms\\Classes\\Controller')->setStatusCode(404)->run('/404');
     }
     $this->posts = $this->page['posts'] = $this->listPosts();
     /*
      * If the page number is not valid, redirect
      */
     if ($pageNumberParam = $this->paramName('pageNumber')) {
         $currentPage = $this->property('pageNumber');
         if ($currentPage > ($lastPage = $this->posts->lastPage()) && $currentPage > 1) {
             return Redirect::to($this->currentPageUrl([$pageNumberParam => $lastPage]));
         }
     }
 }
开发者ID:haegemon,项目名称:blog-plugin,代码行数:19,代码来源:Posts.php

示例7: onRun

 /**
  * @see RainLab\Blog\Components\Posts::onRun()
  * @return mixed
  */
 public function onRun()
 {
     $this->prepareVars();
     // map get request to :search param
     $searchTerm = \Input::get('search');
     if (\Request::isMethod('get') && $searchTerm) {
         return Redirect::to($this->currentPageUrl([$this->searchParam => urlencode($searchTerm)]));
     }
     // load posts
     $this->posts = $this->page['posts'] = $this->listPosts();
     /*
      * If the page number is not valid, redirect
      */
     if ($pageNumberParam = $this->paramName('pageNumber')) {
         $currentPage = $this->property('pageNumber');
         if ($currentPage > ($lastPage = $this->posts->lastPage()) && $currentPage > 1) {
             return Redirect::to($this->currentPageUrl([$pageNumberParam => $lastPage]));
         }
     }
 }
开发者ID:kentucky-roberts,项目名称:lkncleaning.com,代码行数:24,代码来源:SearchResult.php


注:本文中的Collection::lastPage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。