What is a good way to go about Custom Pagination?

Alright so im curious about how this process works.

Right now I got a table and im going to change how each index is viewed by using the Offset function inside of said table.

For my eyes and the users, I want to have it paginated with what, and going based off what I see in the group plugin, you get something like url/link?offset=X

So im using some code to hopefully figure it out, and would like some assistance if possible.

<ul class="elgg-pagination">
<a href="url/link?offset=X<?php $start  -=  $back?>">Back 10</a>
<a href="url/link?offset=X<?php $start += $Foward?>">Forward 10</a>


The issue im having currently, is that this table may have a LOT of information, so going only 10 per page may create lots and lots of pages, and seeing as its only 10 forward and 10 back, I want to add page numbers in between them like you could see in any decent pagination program.

As well, it seems the php code i have in between those doesn't work as I thought it would. They're simple number variables that should add, subtract 10 from the offset depending on which button is pressed. However, they dont seem to affect it at all and the offset remains blank.

Can any point me in the right direction or give me some pointers towards this?


  • I managed to get Offset to work as I wanted, so that is well. Now to the second point, does anyone know how to make the offset dynamic based on how many actual items there are in the loop?

  • Pagination layout is done in views/default/navigation/pagination.php. You could override this view and customize the pagination how you need it.

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking