PHP 分页函数
如果如下:
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAmgAAABOCAIAAAAb530cAAALF0lEQVR4Ae3db2gb5x3A8ZOdsKVJRbtkndkItGgpqUtc8qa44Bcpybx0xRv2AmUUBjHUITFquzKUQAd900DiF6WtcULNcF4sJStkzoqbNtMSloJhZm/CYpp2y0QLYSOwhiSu1XY4tvc8Op18jU6ne053zz2WviLE1um558/nd7rfPfcnSRWLRYsXAggggAACCAQTaAtWjFIIIIAAAgggIAVInGwHCCCAAAIIKAiQOBWwKIoAAggggACJk20AAQQQQAABBQESpwIWRRFAAAEEECBxsg0ggAACCCCgIEDiVMCiKAIIIIAAAiROtgEEEEAAAQQUBEicClgURQABBBBAgMTJNoAAAggggICCAIlTAYuiCCCAAAIIkDjZBhBAAAEEEFAQIHEqYFEUAQQQQAABEifbAAIIIIAAAgoCJE4FLIoigAACCCBA4mQbQAABBBBAQEGAxKmARVEEEEAAAQRInGwDCCCAAAIIKAiQOBWwKIoAAggggACJk20AAQQQQAABBQESpwIWRRFAAAEEEFgTCcHS0pKoZ3l5OZLaDK8klUqJHra1eR9zLN+5M/fm+Ffv/3nxP9cjH0j79zvW/eRH6eeHUmuiCVzkPaRCBBAwQYB9cqxRSBWLxQYbEBFqkZTphhLp0zN33n7t2Pxvf+cuGfnv9z73y/Sv9kdeLRUigEBzCLBPjjuO3tMmpVZbMGsKn1qj/urd95X0QhT+8o9nQ6zFKggg0CICtfZOzT18naOOIHE2dzBUR7f43xuqq6iW19CEapcojwACCLSOAImzdWLNSBFAAAEEIhAgcUaASBUIIIAAAq0jQOJsnVgzUgQQQACBCARInBEgUgUCCCCAQOsIkDhbJ9aMFAEEEEAgAgESZwSIVIEAAggg0DoCJM7WiTUjRQABBBCIQIDEGQEiVSCAAAIItI7AKvonT6dvbvtw3ezL31YPzsKJwRuv/dNnvTUvndq0d7NPAT5CAAEEmlgg/0J6zwnf8e09PfdGr28J+WHh2K7th/7mU+zxI5fOH8j4FFgV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q9sirjGqurav/fdqmUsQAABBBDQJBBB4kylUpo6a1IztUa97qdPxd3Ne+JvIu4hUD8CCMQnUGvvFF+LJtSsc9QR/LdibW1tS0tLy8vLJtjp6YOIkBi1Z1vp54fE8i//MLV085ZngUYWtt1/3z0/77s3+1wjlbAuAgg0twD75LjjG8E/uRd3F6kfAQQQQAABcwS8p03m9I+eIIAAAgggYJQAidOocNAZBBBAAAHTBUicpkeI/iGAAAIIGCVA4jQqHHQGAQQQQMB0ARKn6RGifwgggAACRgmQOI0KB51BAAEEEDBdgMRpeoToHwIIIICAUQIkTqPCQWcQQAABBEwXIHGaHiH6hwACCCBglACJ06hw0BkEEEAAAdMFSJymR4j+IYAAAggYJUDiNCocdAYBBBBAwHQBEqfpEaJ/CCCAAAJGCZA4jQoHnUEAAQQQMF2AxGl6hOgfAggggIBRAiROo8JBZxBAAAEETBcgcZoeIfqHAAIIIGCUAInTqHDQGQQQQAAB0wVInKZHiP4hgAACCBglQOI0Khx0BgEEEEDAdAESp+kRon8IIIAAAkYJ/B/SFatjNEJejAAAAABJRU5ErkJggg==" alt="" />aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAnEAAAA9CAIAAABN6qhRAAAJuklEQVR4Ae2dXWwUVRTHZ1sCgUqj4EejD5XUxlIIhBdSXwUbFNuktc8mbQKNkEJNSEt8NSF0Y0yxgYTGlAd58AFbpUBwpRqfbHhp5KNW62J90JAYqoBAQNp6Z/Zjtu2wOzM7987H/jYNnb17595zfmfu+d+5d7bE7t27p/GCAAQgAAEIQKBoAmVFt0ADEIAABCAAAQjoBNBUrgMIQAACEICANwTQVG840goEIAABCEAATeUagAAEIAABCHhDAE31hiOtQAACEIAABNBUrgEIQAACEICANwTQVG840goEIAABCEAATeUagAAEIAABCHhDAE31hiOtQAACEIAABNBUrgEIQAACEICANwTQVG840goEIAABCEBghR0E8/PzotrCwoKdymGvE4vFhAtlZcw2wh5JH+xfePz4zieDDy58M/fnTc+7L3+xavVbb1Qe2BtbYW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QJ57rFJ1IB3rmXy8xXTa/1L5V/n3YnUtG+Iq3n54zUxg/JfrrxuHy179/kzI+PR/z2xTcyXy5zfC8StdnyZYqPHtkb9bKkY2PV8E5XHV0097GVwIr+uwrLsI/4kwS2Bu1j5EXFwEs9FqhK1AMh4W35CkWKQd/fpQtbD07m43bsMF5SRJsgsCEIAABFwTSGA1XLenr5htViPyV0f160OVAZEJkuAGLlxcBLPRaugPddZEXVDOmtxJBAIQgEBOEZjPVmO+HggXF8GMrNWYr3zJGwIQgAAEIAABpwSwGk6JUR4CEIAABCAAAQcEsBoOYFEUAhCAAAQgAAGnBLAaTolRHgIQgAAEIAABBwSwGg5gURQCEIAABCAAAacEsBpOiVEeAhCAAAQgAAEHBLAaDmBRFAIQgAAEIAABpwSwGk6JUR4CEIAABLKFQME3VgadSsE3vx60RM63795q5OXl5TyduR1cmL2ey4EIBCAAgWwgsGzbU0Gn8UACiYV5OXDXa/f/iXx+fv7U1NT09HTQhzl72hfE0uvsyYdMIAABCCxwAsUv1guBz//YO3Xzlu8o8h968IGfVBc1vqBtmYugFos26P4Pk2ubIwgBCEAAAhCAAASsBLhHt9JgGwIQgAAEIAABnwlgNXwGSnMQgAAEIAABCFgJYDWsNNiGAAQgAAEIQMBnAlgNn4HSHAQgAAEIQAACVgJYDSsNtiEAAQhAAAIQ8JkAVsNnoDQHAQhAAAIQgICVAFbDSoNtCEAAAhCAAAR8JoDV8BkozUEAAhCAAAQgYCWA1bDSYBsCEIAABCAAAZ8JYDV8BkpzEIAABCAAAQhYCfwfQYwc5xo7BdsAAAAASUVORK5CYII=" alt="" />
代码:
/* 分页函数
* @$record_num 总记录数
* @page_size 每页数量
* @cur_page 当前页数
* @show_page_num 显示页码数量
* @url 链接
* @return 分页html
* */
function _page($record_num,$page_size,$cur_page,$url,$show_page_num=9){ if($record_num <= $page_size){ return ''; }
if($page_size <= 0){ return ''; }
if($show_page_num < 3){ $show_page_num = 9; } $page_num = ceil($record_num/$page_size); $html = '
<div id="next_p">
<div class="pages" >'; $html .= ($cur_page > 1) ?
'<li class="prepage"><a class="prev" href="'.$url.'&page='.($cur_page-1).'"> < 上一页</a></li>' :
'<li class="prepage"><a class="prev" href="javascript:void(0)"> < 上一页</a></li>'; if($page_num > $show_page_num){
if($cur_page < ($show_page_num-1) ){
for($i=1;$i<= ($show_page_num-1); $i++){
$html .= ($cur_page == $i) ?
'<li><strong>'.$i.'</strong></li>' :
'<li><a href="'.$url.'&page='.$i.'">'.$i.'</a></li>' ;
}
$html .= '<li style="border:none;font-weight:bold;padding-top:8px; color:#999;">...</li>';
$html .= '<li><a href="'.$url.'&page='.$page_num.'">'.$page_num.'</a></li>';
}else if( $cur_page >= ($show_page_num-1) && $cur_page < ($page_num - $show_page_num -1) ){
$html .= '<li><a href="'.$url.'&page=1">1</a></li>';
$html .= '<li style="border:none;font-weight:bold;padding-top:8px; color:#999;">...</li>';
for($i=($cur_page-3);$i<$cur_page;$i++ ){
$html .= '<li><a href="'.$url.'&page='.$i.'">'.$i.'</a></li>';
}
$html .= '<li><strong>'.$cur_page.'</strong></li>';
for($i=$cur_page+1;$i<$cur_page+4;$i++ ){
$html .= '<li><a href="'.$url.'&page='.$i.'">'.$i.'</a></li>';
}
$html .= '<li style="border:none;font-weight:bold;padding-top:8px; color:#999;">...</li>';
$html .= '<li><a href="'.$url.'&page='.$page_num.'">'.$page_num.'</a></li>';
}else{
$html .= '<li><a href="'.$url.'&page=1">1</a></li>';
$html .= '<li style="border:none;font-weight:bold;padding-top:8px; color:#999;">...</li>';
for($i=($page_num - $show_page_num -1);$i<= $page_num; $i++){
$html .= ($cur_page == $i) ?
'<li><strong>'.$i.'</strong></li>' :
'<li><a href="'.$url.'&page='.$i.'">'.$i.'</a></li>' ;
}
}
}else{
for($i = 1; $i < $page_num; $i++){
$html .= ($cur_page == $i) ?
'<li><strong>'.$i.'</strong></li>' :
'<li><a href="'.$url.'&page='.$i.'">'.$i.'</a></li>' ;
}
} $html .= ($cur_page < $page_num) ?
'<li class="nextpageg_g"><a class="next" href="'.$url.'&page='.($cur_page+1).'"> 下一页 > </a></li>' :
'<li class="nextpageg_g"><a class="next" href="javascript:void(0)"> 下一页 > </a></li>' ; $html .= '
<div class="clear"></div>
</div>
</div>'; return $html;
}
PHP 分页函数的更多相关文章
- Oracle分页函数(存储过程)
create or replace package body Get_RecordByPage is StrSQL ); --分页函数 procedure GetRecordByPage(tblNam ...
- PHP基于数组的分页函数(核心函数array_slice())
关于数组的分页函数,用数组进行分页的好处是可以方便的进行联合多表查询,只需要将查询的结果放在数组中就可以了以下是数组分页的函数,函数page_array用于数组的分页,函数show_array用于分页 ...
- V9自定义分页函数
大家做网站的时候,可能很多时候分页样式都得根据模板的要求来控制的,这时很多人都会去修改全局文件phpcms\libs\functions \global.func.php里的pages()函数,这样问 ...
- phpcms v9 自定义伪静态的分页函数
因为.这个页面还没做好..等做好了..再给大家演示...... 调用方法:$page_attr=pages_open($num[0]['cun'],$get_page,$max_page,'http: ...
- PHPCMS快速建站系列之自定义分页函数
内容分页的实现方法:{pc:content action="lists" catid="$catid" order="id DESC" nu ...
- PHP实现仿Google分页效果的分页函数
本文实例讲述了PHP实现仿Google分页效果的分页函数.分享给大家供大家参考.具体如下: /** * 分页函数 * @param int $total 总页数 * @param int $pages ...
- Django学习手册 - 自定义分页函数
前端代码: <div class="xianshi"> {% for i in info %} <ul> <li>{{ i }}</li& ...
- mysql的sql分页函数limit使用 (转)
http://www.cnblogs.com/beijingstruggle/p/5631603.html mysql的sql分页函数limit使用 My sql数据库最简单,是利用mysql的LIM ...
- php 自定义 分页函数
<?php /** * 分页函数 * @param type $num 数据总数 * @param type $perpage 每页总数 * @param type $curpage 当前分页 ...
随机推荐
- linux 下安装 mysql5.7.16安装
1.groupadd mysql ## 添加一个mysql组 2.useradd -r -g mysql mysql ## 添加一个用户 3.解压缩下载的包,tar -xzvf /da ...
- N皇后问题—初级回溯
N皇后问题,最基础的回溯问题之一,题意简单N*N的正方形格子上放置N个皇后,任意两个皇后不能出现在同一条直线或者斜线上,求不同N对应的解. 提要:N>13时,数量庞大,初级回溯只能保证在N< ...
- Jni :三维数组处理方法 ,以整形三维数组为例 C++实现
本文原创,转载请注明地址:http://www.cnblogs.com/baokang/p/4982846.html 关于Jni的基本使用方法,请参阅:Java 调用 C++ (Java 调用 dll ...
- UML类图符号 各种关系说明以及举例
UML中描述对象和类之间相互关系的方式包括:依赖,关联,聚合,组合,泛化,实现等. 表示关系的强弱:组合>聚合>关联>依赖 相互间关系 聚合是表明对象之间的整体与部分关系的关联,而组 ...
- Visual Studio 常用快捷键备忘
在代码中插入书签 用途 操作 vs2013 快速在自定义的不同代码位置跳转 首先点击: 编辑=>书签=>启用书签 然后再在代码编辑窗口 ctrl+k, k (取消书签,再按一次 ctr ...
- SSH使用详解
一.SSH基础 (1)什么是SSH? 传统的网络服务程序,如:ftp.pop和telnet在本质上都是不安全的,因为它们在网络上用明文传送口令和数据,别有用心的人非常容易就可以截获这些口令和数据.而且 ...
- 记录NS_ASSUME_NONNULL_BEGIN和NS_ASSUME_NONNULL_END。
Nonnull区域设置(Audited Regions) 如果需要每个属性或每个方法都去指定nonnull和nullable,是一件非常繁琐的事.苹果为了减轻我们的工作量,专门提供了两个宏:NS_AS ...
- ofbiz定时任务配置
1.一个service的java类 2.在framework/service/servicedef/service.xml中配置上一步的service服务. <service name=&quo ...
- (转)Redis 的 5 个常见使用场景
在这篇文章中,我们将阐述 Redis 最常用的使用场景,以及那些影响我们选择的不同特性. 1.会话缓存(Session Cache) 最常用的一种使用Redis的情景是会话缓存(session cac ...
- iOS设计 - 一款APP从设计稿到切图过程概述
这篇文章站在GUI设计师的角度概述了APP从项目启动到切片输出的过程,相当于工作流程的介绍.这里写的不是一种规范,只是一种工作方法,加上技术的更新是非常快的,大家在具体工作中,一定要灵活运用. 这里我 ...