2015-11-25 50 views
0

在我的分頁中,有最後一個頁碼重複。如何把cakephp分頁中的最後一個頁碼之前的下一個鏈接

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> 

回答

0

您可以隨時使用這個方法$這個 - > Paginator->電流($模型),這會給你當前頁碼

if($this->Paginator->current($model) != $last) { 
    echo $this->Paginator->last($last, array('rest of options')); 
} 

我希望這可以幫助你。這裏是你可以獲得關於paginator helper class的信息的鏈接。

Paginator Helper Class CakePHP

相關問題