PEAR: Pager. Displaying a large amount of data on a page is a common practice in WEB projects, but limited by the size of the screen, in order to facilitate user reading, we usually need to display the data by page, therefore, it is common for WEB projects to display a large amount of data on pages by page. however, to make the screen size easier for users to read, we usually need to display the data by page, therefore, the paging function is indispensable for most projects. PEAR: Pager is a powerful paging class, which is very convenient to use.
System requirements: PHP4.3. */PHP5, PEAR: Pager
PEAR: Pager has two paging display modes: Jumping and Sliding. What are the differences 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"
Displayed page number: ". $ params ['Delta'];
Echo"
Specific data array :";
Print_r ($ params ['itemdata']);
$ Pager = & Pager: factory ($ params );
$ Data = $ pager-> getPageData ();
$ Links = $ pager-> getLinks ();
Echo"
Final effect :";
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 ().:';
...