We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Customize Pagination

Hello Friends, Currently I am using default pagination provided by phalcon framework which is working fine. It looks something like below:

For Example : First Previous Next Last 1/71

And Code for above is :

<td><?php echo $this->tag->linkTo("userdashboard/rediscover", "First") ?></td>
<td><?php echo $this->tag->linkTo("userdashboard/rediscover?page=" . $page_rediscover->before, "Previous") ?></td>
<td><?php echo $this->tag->linkTo("userdashboard/rediscover?page=" . $page_rediscover->next, "Next") ?></td>
<td><?php echo $this->tag->linkTo("userdashboard/rediscover?page=" . $page_rediscover->last, "Last") ?></td>
<td><?php echo $page_rediscover->current, "/", $page_rediscover->total_pages ?></td>

My requirement is something like: 1 2 3 Next ›Last »

How it can be done pls help me!!!


"Something like" isn't very exact, so there is still some different possibilities. Basically though, the paginator can tell you what page you're on. You can do some logic then, to conditionally output a link to the current page + 1, or the current page - 1.