【问题标题】:Get the digit of last page in Cakephp在 Cakephp 中获取最后一页的数字
【发布时间】:2012-08-09 05:53:37
【问题描述】:

如何获取最后一个页码,而不是 $this->Paginator->last() 附带的链接,而是实际数字本身?

【问题讨论】:

    标签: cakephp cakephp-2.0 cakephp-2.1


    【解决方案1】:

    This link 将帮助您实现同样的目标。

    <?php echo $this->Paginator->counter('{:pages}');
         //counter() method with all options
         //echo $this->Paginator->counter('Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}');?>
    

    您可以在视图中调用 counter() 方法来获取最后的页码。

    【讨论】:

    • 我不需要 :end 但 :pages 可以工作。所以我会给你答案。
    【解决方案2】:

    另一种解决方案:

    echo $this->Paginator->param('pageCount');
    

    【讨论】:

      猜你喜欢
      • 2013-06-13
      • 2015-01-04
      • 2021-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-05
      • 2015-12-01
      相关资源
      最近更新 更多