¥result = <div class=\page-num\><ul class=\fn-clear\>;
// 上一页
if (¥offset>0) {
¥result .= <li>
<a href=\.¥url.offset=.(¥offset-¥maxrow).\>Prev</a>
</li>;
}
¥pages = ¥allPageNums; //总页数
¥page = ¥curPage; //当前页数
¥page_len = 9;
¥page_len = (¥page_len%2)?¥page_len:¥pagelen+1;//页码个数
¥pageoffset = (¥page_len-1)/2;//页码个数阁下偏移量
if(¥pages>¥page_len){
//若是当前页小于便是左偏移
if(¥page<=¥pageoffset){
¥init=1;
¥max_p = ¥page_len;
}else{//若是当前页大于左偏移
//若是当前页码右偏移超出最大分页数
if(¥page+¥pageoffset>=¥pages+1){
¥init = ¥pages-¥page_len+1;
¥max_p = ¥pages;
}else{
//阁下偏移都存在时的策画
¥init = ¥page-¥pageoffset;
¥max_p = ¥page+¥pageoffset;
}
}
} else {
¥init = 1;
¥max_p = ¥pages;
}
for(¥i=¥init; ¥i<=¥max_p; ¥i++) {
if ( ¥i == ¥curPage ) {
¥result .= <li class=\on\><a href=\.¥url.offset=.(¥i¥maxrow).\ >¥i</a></li>;
continue;
}
¥result .= <li><a href=\.¥url.offset=.((¥i-1)¥maxrow).\>¥i</a></li>;
}
// 打印下一页
if ( ¥allnums > (¥offset+¥maxrow) ) {
¥result .= <li>
<a href=\.¥url.offset=.(¥offset+¥maxrow).\>Next</a>
</li>;
}