![]() |
can anyone explains this snippet in the pagination?
this is a part of a class of aguestbook with pagination
but i can't understand well this mathematical procedure as i am anewbie Code:
var $itemsPerPage = 5;whay the start item is as like that? and this if coded like that? |
Seems like an old class, because of the user of var to define a class property.
I don't know why you would need a $startItem or $endItem if it is an array of items, just loop it, but I guess it queries the whole list of items to paginate and uses those $*Item as keys to window the list. It seems like $startItem is a key for an array (my guess) with which it tells what item is going to be shown first based on what page is being seen. For example if you are on page 4 then the math will be (4-1)*5 so $startItem=15 which will start in the 15th item. I guess the -1 in ($page-1) is because the array starts the count with 0 so if you are in page 1 it will be (1-1)*5 wich $startItem=0 start with item 0 |
| All times are GMT. The time now is 05:43 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0