Hi,
I can not get my head around the best way to ensure that the books looped through in the for loop are from the correct page.
The books in the $bookList arrray appear to be all of the books and are not limited to a per page basis.
The only work around I can see is to use an if statement in the loop and use the key to test against the $page->getFirstIndex() and $page->getLastIndex() methods, such as below.
PHP Code:
for ( $bookList->rewind(); $bookList->valid(); $bookList->next() )
{
if ( $key >= $bookPage->getFirstIndex() && $key < $bookPage->getLastIndex() ) {
printf(" <tr><td>%s</td><td>%s</td><td>%s</td></tr>\n",$book['title'], $book['author'], $book['publisher']);
}
}
Is there a simpler way to supply the for loop only the books from the page the user is on.
Will appreciate your help.
Cheers
Craig