In the phpZF framework, Google search pages are similar.
In the phpZF framework, Google search pages are similar.
/***** @ Param unknown_type $ model table type * @ param unknown_type $ controller submitted by the ncontroller controller * @ param unknown_type $ action submitted by the naction action */public function fenyepage2 ($ model, $ ncontroller, $ naction) {if (! Isset ($ _ SESSION) {session_start () ;}$ pageSize = $ _ SESSION ['pagesize']; $ pageNow = $ _ SESSION ['pagenow']; $ offset = ($ pageNow-1) * $ pageSize; $ db = $ this-> getAdapter (); $ select = $ db-> select (); $ select-> from ('student ',' * '); if (! Isset ($ _ SESSION) {session_start ();} if ($ _ SESSION ['qsname']! = "") {$ Sname = $ _ SESSION ['qsname']; $ select-> where ('sname like? ', "% $ Sname %");} if ($ _ SESSION ['qsaddress']! = "") {$ Saddress = $ _ SESSION ['qsaddress']; $ select-> where ('saddress like? ', "% $ Saddress %");} if ($ _ SESSION ['qsdept']! = "") {$ Sdept = $ _ SESSION ['qsdept']; $ select-> where ('sdept like? ', "% $ Sdept %") ;}$ coutNews = $ db-> fetchAll ($ select); $ pageCount = ceil (count ($ coutNews)/$ pageSize ); $ select-> limit ($ pageSize, $ offset); // The first parameter: total number of items displayed. The second parameter: $ res = $ db-> fetchAll ($ select); $ native = null; $ native = "homepage "; if ($ pageNow> 1) {$ nextPage = $ pageNow-1; $ native. = "previous page";} if ($ pageNow-1)> 5) {if ($ pageNow + 4> $ pageCount) {// $ start = $ pageCount-9 if the last page number and the number of pages that should have started earlier than 10; // the difference between the start page and the end page 9} else {$ start = $ pageNow-5; // difference between the start position and end position 5} else {$ start = floor ($ pageNow-1)/10) * 10 + 1 ;} if ($ pageCount >=$ start + 10) {$ index = $ start + 10;} else {$ index = $ pageCount + 1 ;}for (; $ start <$ index; $ start ++) {$ native. = "$ start";} if ($ pageNowarrs = $ res; $ model-> native = $ native ;}
The above is the content similar to Google search pages in the phpZF framework. For more information, see PHP Chinese website (www.php1.cn )!