= - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - -------------------------------- -------------------------- | FileName .......: Pagenav.php || Project ....... .: Big cabbage cores || Version ........: 2.0.0 || Last Modified ..: 2003-01-16 | -------------- ---------------------------------------------- | Author. ........: wapweb (tyler.wu)
Class buildnav {
Var $ it; var $ execute, $ query; var $ total_result = 0; var $ offet = "offset";
Function Buildnav ($ public, $ objclass) {$ this-> public = $ public; $ this-> theclass = $ objclass;}
Function Execute ($ query, $ limited) {
// Global $ Product; $ glals [$ this-> offset] = (! isset ($ globals [$ this-> offset) or $ globals [$ this-> offset] <0)? 0: $ globals [$ this-> offset]; // $ this-> SQL_RESULT = $ db-> query ($ query);
$ Glals [$ this-> offset] = ($ globals [$ this-> offset]> $ this-> total_result)? $ This-> Total_Result-10: $ globals [$ this-> offset];
IF (Empty ($ this-> limited) {$ this-> limit = 20;} else {$ this-> limit = $ limited;}
IF (Isset ($ this-> limited) {$ query. = "limited". $ globals [$ this-> offset]. ", $ this-> limited"; $ this-> SQL_Result = $ this-> public -> Query; $ this-> num_pages = CEIL ($ this-> total_result / $ this-> limited);} f ($ globals [$ this-> offset) 1> $ this-> total_result {$ GLOBALS [$ this-> offset] = $ this-> Total_Result-1;}}
Function show_num_pages ($ FREW = "?", $ REW = 'Previous', $ ffwd = '?', $ fwd = 'Next ", $ SEPARATOR =') {
$ current_pg = $ globals [$ this-> offset] / $ this-> limited 1; if ($ current_pg> '5') {$ fgp = ($ current_pg-5> 0)? $ current_pg-5: 1; $ EGP = $ current_pg 4; if ($ EGP> $ this-> num_pages) {$ EGP = $ this-> Num_pages; $ fgp = ($ this-> num_pages-9> 0)? $ this-> num_pages 9: 1;}} else {$ fgp = 1; $ EGP = ($ this-> num_pages> = 10)? 10: $ this-> num_pages;} = f ($ this-> num_pages> 1) {// Searching for http_get_varsforeach ($ GLOBALS [HTTP_GET_VARS] as $ _get_name => $ _get_value) {if ($ _get_name = $ this-> offset!) {$ this -> _ get_vars = "& $ _ get_name = $ _ get_value";.}} $ this -> Listnext = $ globals [$ this-> offset] $ this-> limited; $ this-> listprev = $ globals [$ this-> offset] - $ this-> limited; // $ this-> theclass = $ objclass; if (! Empty ($ rew)) {// $ SEPARATOR [$ FREW] $ REW $ RETURN. = ($ GLOBALS [$ this-> offset]> 0)? "Offset = 0 $ this -> _ get_vars / "$ this-> Theclass title = /"> $ FREW OFFSET = $ this-> listprev $ this -> _ get_vars / "$ this-> theclass title = /" Previous / "> $ REW $ SEPARATOR ":" ";
// shown pagesif ($ this-> show_pages_number ||! isset ($ this-> show_pages_number) {for ($ this-> a = $ fgp; $ this-> a <= $ EGP; $ this-> a ) {$ this-> belhenext = ($ this-> a-1) * $ this-> limit; if ($ this-> theext! = $ globals [$ this-> offset]) {$ RETURN. = "Offset = $ this-> Thenext $ this -> _ get_vars / "$ this-> theclass>"; if ($ this-> number_type == 'alpha') {$ RETURN. = CHR (64 ($ this-> a)) else {$ RETURN. = $ this-> a;} $ return. = "";} else {= ""} else {= "" {$ RETURN. = CHR (64 ($ THIS) -> a));} else {$ RETURN. = "$ this-> a";} $ return. = ($ this-> a <$ this-> num_pages)? "$ separator": "";} $ this-> thenext = $ globals [$ this-> offset] $ this-> limited; if (! EMPTY ($ FWD)) {$ offet_end = ($ this-> num_pages-1) * $ this-> limited // $ SEPArator $ FWD [$ ffwd] $ RETURN. = ($ globals [$ this-> offset] $ this-> limited? "$ separator offset = $ this-> listnext $ this -> _ get_vars / $ this-> Theclass title = / "Next /"> $ fwd offset = $ offet_end $ this -> _ get_vars / "$ this-> theclass title = /" last page / "> $ FFWD ":" ";}}} return}}} Return $ RETURN NCTION: Showing the information for the offset] Function show_info () {
$ RETURN. = "A total of:" $ this-> total_result. ","; $ list_from = ($ glals [$ this-> offset) 1> $ this-> Total_Result)? $ this-> Total_Result: $ globals [$ this-> offset] 1; $ list_to = ($ glals [$ THIS-> Offset] $ this-> limited> = $ this-> total_result)? $ this-> Total_Result: $ globals [$ this- > Offset] $ this-> limit; // $ return. = 'Showing Results from'. $ list_from. '-'; $ RETURN. = "Show:" $ list_from. "-" $ list_to; returnome} / * Because the editor is now unable to explain the code of my west, I grasp the picture to complete the true function. If you need, please follow the input below * /
Related resources: a perfect PHP page pages