如何在cakephp分页的最后一页编号之前放置Next链接

时间:2015-11-25 07:21:17

标签: cakephp pagination

在我的分页中,有重复的最后一页编号。

This is my current pagination.

<?php
      $last = $this->Paginator->counter('{:pages}');
      $first = $last - $last + 1;           
?>
<ol>
   <?php
echo $this->Paginator->first($first,array('tag'=>'li','currentTag'=>'a',
'escape' => false));

echo $this->Paginator->prev('&laquo;', array('tag' => 'li',  'title' => __('Previous page'), 'disabledTag' => 'span', 'escape' => false), null, array('tag' => 'li', 'disabledTag' => 'span', 'escape' => false, 'class' => 'disabled'));

 echo $this->Paginator->numbers(array('modulus' => '4', 'separator' => false, 'tag' => 'li', 'currentTag' => 'a'));

echo $this->Paginator->next('&raquo;', array('tag' => 'li', 'disabledTag' => 'span', 'title' => __('Next page'), 'escape' => false), null, array('tag' => 'li', 'disabledTag' => 'span', 'escape' => false, 'class' => 'disabled'));

echo $this->Paginator->last($last, array('tag' => 'li', 'currentTag' => 'a', 'escape' => false));

?>
</ol>

1 个答案:

答案 0 :(得分:0)

您可以随时使用此方法$ this-&gt; Paginator-&gt; current($ model),这将为您提供当前页码

namespace

我希望这会对你有所帮助。这里是您可以获取有关paginator helper类的信息的链接。

Paginator Helper Class CakePHP