Displaying a large amount of data on a page is a common practice in WEB projects, but limited by the size of the screen, we usually need to display the data by Page to make it easier for users to browse, therefore, the paging effect is indispensable for most projects. PEAR: Pager is
Displaying a large amount of data on a page is a common practice in WEB projects, but limited by the size of the screen, we usually need to display the data by Page to make it easier for users to browse, therefore, the paging effect is indispensable for most projects. PEAR: Pager is a powerful paging class with very convenient applications.
System requirements: PHP4.3. */PHP5, PEAR: Pager
PEAR: Pager has two paging display modes: Jumping and Sliding. What is the difference between the two? let's look at two examples:
Jumping. php
Require_once 'pager/Pager. php ';
$ Params = array (
'Mode' => 'jumping ',
'Perpage' => 3,
'Delta' => 5,
'Itemdata' => array ('A', 'B', 'C', 'D', 'e', 'z', 'Ty ', 'xc ', 'fg', 'fg', 'JK ', 'hj', 'Ty ', 'xc', 'e', 'z', 'Ty ', 'xc ', 'fg', 'fg', 'JK ', 'hj', 'Ty ', 'xc ')
);
Echo'
Current paging mode: '. $ params ['mode'];
Echo'
Number of data entries per page: '. $ params ['perpage'];
Echo'
Number of displayed pages: '. $ params ['Delta'];
Echo'
Specific data array :';
Print_r ($ params ['itemdata']);
$ Pager = & Pager: factory ($ params );
$ Data = $ pager-> getPageData ();
$ Links = $ pager-> getLinks ();
Echo'
Final consequence :';
Echo $ links ['all'];
Echo $ pager-> linkTags;
Echo'
Data on the current page :';
Echo'
';
print_r($data);
echo '
';
Echo 'data obtained by other class methods:
';
Echo 'getcurrentpageid ()...:';
Var_dump ($ pager-> getCurrentPageID ());
Echo'
';
Echo 'getnextpageid ()......:';
Var_dump ($ pager-> getNextPageID ());
Echo'
';
Echo 'getpreviouspageid ()..:';
Var_dump ($ pager-> getPreviousPageID ());
Echo'
';
Echo 'numitems ()...........:';
Var_dump ($ pager-> numItems ());
Echo'
';
Echo 'numpages ()...........:';
Var_dump ($ pager-> numPages ());
Echo'
';
Echo 'isfirstpage ()........:';
Var_dump ($ pager-> isFirstPage ());
Echo'
';
Echo 'islastpage ().........:';
Var_dump ($ pager-> isLastPage ());
Echo'
';
Echo 'islastpagecomplete ().:';
Var_dump ($ pager-> isLastPageComplete ());
Echo'
';
Echo '$ pager-> range ........:';
Var_dump ($ pager-> range); echo'
';
?>
The running result is as follows:
Sliding. php