Function fPageCount ($ TotalResult, $ numPerPage, $ Page ){
$ NaviLength = '10'; // display quantity
$ ShowMorePageGo_Type _ = 0; // jump style
$ Int_showNumberLink _ = '10 ';
$ NonLinkColor _ = "#999999 ";
$ ToF _ = "<font face = webdings title =" Homepage "> 9 </font> ";
$ ToP10 _ = "<font face = webdings title =" Top 10 pages "> 7 </font> ";
$ ToP1 _ = "<font face = webdings title =" Previous Page "> 3 </font> ";
$ ToN1 _ = "<font face = webdings title =" next page "> 4 </font> ";
$ ToN10 _ = "<font face = webdings title =" next 10 pages "> 8 </font> ";
$ ToL _ = "<font face = webdings title =" last page ">:</font> ";
$ Page_index = "";
$ Tpagecount = ceil ($ TotalResult/$ numPerPage );
$ NowCoolPage = ceil ($ Page/$ NaviLength );
$ ToPage _ = $ _ SERVER ['query _ string'];
If ($ toPage _ = ''){
$ ToPage _ = "? Page = ";
} Else {
$ ToPage _ = preg_replace ("/&? Page = d +/",'', $ toPage _);
$ ToPage _ = "? ". $ ToPage _." & page = ";
}
If ($ nowCoolPage = 1 ){
$ Page_index. = "<font color =". $ nonLinkColor _. "title =" Homepage ">". $ toF _. "</font> ";
$ Page_index. = "<font color = ". $ nonLinkColor _. "title =" TOP ". $ int_showNumberLink _. "page"> ". $ toP10 _. "</font> ";
} Else {
$ PreRow = $ Page-$ NaviLength;
$ Page_index. = "<a href =". $ toPage _. "1 title =" Homepage ">". $ toF _. "</a> ";
$ Page_index. = "<a href = ". $ toPage _. $ preRow. "title =" TOP ". $ int_showNumberLink _. "page"> ". $ toP10 _. "</a> ";
}
$ UpRow = $ Page-1;
$ DownRow = $ Page + 1;
If ($ upRow> 0 ){
$ Page_index. = "<a href =". $ toPage _. $ upRow. "title =" Previous Page ">". $ toP1 _. "</a> ";
} Else {
$ Page_index. = "<font color =". $ nonLinkColor _. "title =" Previous Page ">". $ toP1 _. "</font> ";
}
For ($ I = 1; $ I <= $ NaviLength; $ I ++ ){
$ NowPage = ($ nowCoolPage-1) * $ NaviLength + $ I;
If ($ nowPage! = $ Page ){
If ($ nowPage <= $ tpagecount ){
$ Page_index. = "<a href =". $ toPage _. $ nowPage. ">". $ nowPage. "</a> ";
} Else {
Break;
}
} Else {
If ($ tpagecount! = 1 ){
$ Page_index. = "<B>". $ nowPage. "</B> ";
}
}
}
If ($ downRow <= $ tpagecount ){
$ Page_index. = "<a href =". $ toPage _. $ downRow. "title =" Next ">". $ toN1 _. "</a> ";
} Else {
$ Page_index. = "<font color =". $ nonLinkColor _. "title =" next page ">". $ toN1 _. "</font> ";
}
If ($ nowCoolPage ==$ tpagecount ){
$ Page_index. = "<font color = ". $ nonLinkColor _. "title =" bottom ". $ int_showNumberLink _. "page"> ". $ toN10 _. "</font> ";
$ Page_index. = "<font color =". $ nonLinkColor _. "title =" last page ">". $ toL _. "</font> ";
} Else {
$ NextRow = $ Page + $ NaviLength;
$ TheEndRow = $ tpagecount;
$ Page_index. = "<a href = ". $ toPage _. $ nextRow. "title =" bottom ". $ int_showNumberLink _. "page"> ". $ toN10 _. "</a> ";
$ Page_index. = "<a href =". $ toPage _. $ theEndRow. "title =" last page ">". $ toL _. "</a> ";
}
If ($ showMorePageGo_Type _ = 1 ){
$ Show_Page_ I = $ Page + 1;
If ($ Show_Page_ I> $ tpagecount) $ Show_Page_ I = 1;
$ Page_index. = "Jump <input type = 'text' id = 'skip' value = ''onkeyup = 'this. value = this. value. replace (/[^ d] +/, '') 'style = 'width: 40px '/> <input type = 'button 'value =' 'class = 'btn' onclick = 'location. href = '? Page = '+ $ ('skip'). value +' ". $ toPage _." ';'/> n ";
} Else {
$ Page_index. = "Jump: <select name = 'select' size = '1' style = 'font-size: 12px 'onchange = 'javascript: window. location. href = this. options [this. selectedIndex]. value '> ";
For ($ I = 1; $ I <= $ tpagecount; $ I ++ ){
If ($ Page = $ I ){
$ Selected = "selected ";
} Else {
$ Selected = "";
}
$ Page_index. = "<option value =". $ toPage _. $ I;
$ Page_index. = $ selected. "style = 'color: # ff0000 '";
$ Page_index. = "> page". $ I. "</option> ";
}
$ Page_index. = "</select> ";
}
$ Page_index. = $ p _. $ sp2 _. "per page <B> ". $ numPerPage. "</B> records, which are: <B> <span class = 'tx '> ". $ sp2 _. $ Page. "</span> /". $ tpagecount. "</B> page, total <B> <span id = 'recordcount'> ". $ sp2 _. $ TotalResult. "</span> </B> records. ";
Return $ page_index;
}
Example: <? Php echo fPageCount ($ TotalResult, $ numPerPage, $ page)?> $ TotalResult indicates the total number of items. $ numPerPage: number of items displayed on each page. $ page number