View Single Post
Old 03-27-2011, 07:35 PM   #1 (permalink)
medicalboy
The Visitor
Newcomer 
 
Join Date: Mar 2011
Posts: 1
Thanks: 0
medicalboy is on a distinguished road
Arrow 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;
  $page = isset($_GET['page']) ? $_GET['page'] : 1;

$startItem = ($page-1)*$this->itemsPerPage;
if (($startItem + $this->itemsPerPage) > sizeof($list)) $endItem = sizeof($list);
else $endItem = $startItem + $this->itemsPerPage;
can anyone explains this in detail?,and i'll be appreciated.........
whay the start item is as like that?
and this if coded like that?
medicalboy is offline  
Reply With Quote