This class needs to open the corresponding database before calling. This kind of almost all functions, homepage, topping, next page, last page, jump, front, then turning the page, jump, front, the next page, the last page, the column is displayed, the output text color, the background color, you can set it yourself call easy to use, now write for your reference class file page.php file .page.inc test page is displayed first need to create a database, here is the sale of used: masters email: xyy_003@163.com/** ***************************************** The following is all this paging class Attributes:***********************************************/ VAR $ maxline; / / per page Display line number var $ maxpage; // Directive VAR $ OFFSET; // Record the offset Var $ TOTAL; // Record Total Var $ Result; // Read Result VAR $ TPAGES; / / Total number VAR $ CPAGES; // Current page number var $ SQL; // will be executed SQL statement var $ pageQuery; // Page display to pass the parameter var $ output; // output content VAR $ textsize; // Output size VAR $ textColor; // Output color var $ inbdrcolor; // Output text box Border color var $ inbgcolor; // Output text box Background color / ***** **************************************** The following is all methods of this paging class: * ****************************************************** / constructor Page ($ SQL, $ ML, $ MP, $ TS, $ TC, $ INBDRC, $ INBGC) Parameters: Query SQL statement, maximum line number, number of page numbers per output, output text size, text color, input box Border primary color, input box background original color setting Transfer parameter setPageQuery: Parameter name, parameter value read record, display output showlist ($ StartPage, $ T, $ OF, $ PHP_SELF) Parameters: Output page number Minimal, what kind of way jump flag, data record set offset, current file name This section does not need to give a value, you only need to extend the following variable name when calling Page.inc class file PHP / ******************************* ****************** Page Display Mysql Database Record class class requires the corresponding database to be opened.
************************************************************************************************************************************************************************* / CLASS PAGE {var $ maxline; / / per page Display line number var $ maxpage; // Display the number of parties VAR $ OFFSET; // Record the offset Var $ TOTAL; // Record Total VAR $ Result; // Read Results VAR $ TPAGES; / / Total number VAR $ CPAGES; // Current page number var $ sql; // The SQL statement VAR $ pageQuery to be executed; // Page display to pass the parameter var $ OTPUT; / / output Content VAR $ TEXTSIZE; / / Output Size Var $ TEXTCOLOR; / / Output Color Var $ InBdrcolor; // Outputs Border Color Var $ InBgcolor; // Output Text Box / **** ** Constructor ************* Parameters: Query SQL statement, maximum number of lines, number of page numbers per output, output text size, text color, input frame Box Box, Input Box Background Original color ********************************************** / Function Page ($ SQL, $ ML, $ MP, $ TS, $ TC, $ INBDRC $ INBGC) {$ this-> SQL = URLDECode ($ SQL); $ this-> SQL = Stripslashes ($ this-> SQL); $ this-> maxline = ml; $ this-> maxpage = $ mp; $ this-> textsize = $ TS; $ this-> textcolor = $ tc; $ this-> inbdrcolor = $ inbdrc; $ this-> inbgcolor = $ inbgc;} // ****** Set delivery parameters ** ********* Function setPagePara ($ key, $ value) {$ tmp [key] = $ key; $ THIS-> PageQuery [] = $ TMP;} / ******** Read record, display output ************** parameter: output page number, how to jump, data record set Offset, the current file name This part of the parameters do not require a given value, only the following variable name is only available when calling, *********************************** *************** / FUN Ction showlist ($ StartPage, $ T, $ OF, $ PHP_SELF) {IF ($ Of == ") $ of = 0; $ this-> offset = $ = $ = $ == /; // Determine this offset $ querysql = $ this-> sql; // division determine the start value IF ($ T == 1) {$ startpage = $ startpage $ this-> offset = ($ startPAGE-1) * $ THIS-> Maxline;} IF ($ T == 2) {$ StartPage = $ StartPage- $ THIS-> MaxPage; IF ($ StartPage <1) {$ StartPage = 1;} $ this-> offset = $ startPage-1) * $ this-> maxline;} if ($ t == 3) {$ this-> offset = ($ startPage-1) * $ this-> maxline;} if ($ StartPage <1 or $ STARTPAGE <1 OR $ STARTPAGE == "" "$ startPage = 1; // Calculate the number of records of this query worth $ Result =
MySQL_Query; $ this-> total = mysql_num_rows ($ result); // Put the data of the current page to the corresponding attribute of this class, easy to use $ SQLLIMIT = "Limit" when calling. $ this-> offset ". $ this-> maxline; $ this-> Result = mysql_query ($ querysql. $ sqllimit); $ this-> tpages = CEIL ($ this-> Total / $ this-> maxline); $ this- > Cpages = $ this-> offset / $ this-> maxline 1; $ querysql = urlencode ($ this-> SQL); // Determine the output content, and pay the corresponding attribute of this class.
$ this-> Output =