cakephpcakephp-2.0cakephp-2.1

Get the digit of last page in Cakephp


How do I get just the last page number, not the link that comes with $this->Paginator->last(), but the actual digit itself?


Solution

  • This link will help you to achieve the same.

    <?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}');?>
    

    You can call the counter() method into your view to get the last page number.