Classes only live as long as the current request cycle. It does not matter if you stored a value in the class, next time you press the button you are in a completely new request cycle and with a new copy of the class again.

If for some reason you cannot use the frameworks paginator then you will need something like a page counter that is included in every request and incremented or decremented by the view.

So first page then your URL looks like /mypage?page=1 and you have a next button which has the url /mypage?page=2 then on page 2, a prev button which has /mypage?page=1 and a next button = /mypage?page=3

This is what the pagination class will do for you automatically.

Return to Thread...