




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
第thinkPHP5框架分页样式类完整示例namespacepage;
//+
//|ThinkPHP[WECANDOITJUSTTHINK]
//+
//|Copyright(c)2006~2017Allrightsreserved.
//+
//|Licensed(/licenses/LICENSE-2.0)
//+
//|Author:zhangyajun448901948@
//+
usethink\Paginator;
classPageextendsPaginator
//首页
protectedfunctionhome(){
if($this-currentPage()1){
return"ahref='".$this-url(1)."'title='首页'首页/a
}else{
return"p首页/p
//上一页
protectedfunctionprev(){
if($this-currentPage()1){
return"ahref='".$this-url($this-current1)."'title='上一页'上一页/a
}else{
return"p上一页/p
//下一页
protectedfunctionnext(){
if($this-hasMore){
return"ahref='".$this-url($this-currentPage+1)."'title='下一页'下一页/a
}else{
return"p下一页/p
//尾页
protectedfunctionlast(){
if($this-hasMore){
return"ahref='".$this-url($this-lastPage)."'title='尾页'尾页/a
}else{
return"p尾页/p
//统计信息
protectedfunctioninfo(){
return"p共b".$this-lastPage.
"/b页b".$this-total."/b条数据/p
*页码按钮
*@returnstring
protectedfunctiongetLinks()
$block=[
'first'=null,
'slider'=null,
'last'=null
$side=3;
$window=$side*2;
if($this-lastPage$window+6){
$block['first']=$this-getUrlRange(1,$this-lastPage);
}elseif($this-currentPage=$window){
$block['first']=$this-getUrlRange(1,$window+2);
$block['last']=$this-getUrlRange($this-last1,$this-lastPage);
}elseif($this-currentPage($this-last$window)){
$block['first']=$this-getUrlRange(1,2);
$block['last']=$this-getUrlRange($this-last($window+2),$this-lastPage);
}else{
$block['first']=$this-getUrlRange(1,2);
$block['slider']=$this-getUrlRange($this-current$side,$this-currentPage+$side);
$block['last']=$this-getUrlRange($this-last1,$this-lastPage);
$html='';
if(is_array($block['first'])){
$html.=$this-getUrlLinks($block['first']);
if(is_array($block['slider'])){
$html.=$this-getDots();
$html.=$this-getUrlLinks($block['slider']);
if(is_array($block['last'])){
$html.=$this-getDots();
$html.=$this-getUrlLinks($block['last']);
return$html;
*渲染分页html
*@returnmixed
publicfunctionrender()
if($this-hasPages()){
if($this-simple){
returnsprintf(
'%sdiv%s%s%s/div',
$this-css(),
$this-prev(),
$this-getLinks(),
$this-next()
}else{
returnsprintf(
'%sdiv%s%s%s%s%s%s/div',
$this-css(),
$this-home(),
$this-prev(),
$this-getLinks(),
$this-next(),
$this-last(),
$this-info()
*生成一个可点击的按钮
*@paramstring$url
*@paramint$page
*@returnstring
protectedfunctiongetAvailablePageWrapper($url,$page)
return'ahref="'.htmlentities($url).'"rel="externalnofollow"title="第"'.$page.'"页"'.$page.'/a
*生成一个禁用的按钮
*@paramstring$text
*@returnstring
protectedfunctiongetDisabledTextWrapper($text)
return'p'.$text.'/p
*生成一个激活的按钮
*@paramstring$text
*@returnstring
protectedfunctiongetActivePageWrapper($text)
return'ahref=""externalnofollow"cur"'.$text.'/a
*生成省略号按钮
*@returnstring
protectedfunctiongetDots()
return$this-getDisabledTextWrapper('...');
*批量生成页码按钮.
*@paramarray$urls
*@returnstring
protectedfunctiongetUrlLinks(array$urls)
$html='';
foreach($urlsas$page=$url){
$html.=$this-getPageLinkWrapper($url,$page);
return$html;
*生成普通页码按钮
*@paramstring$url
*@paramint$page
*@returnstring
protectedfunctiongetPageLinkWrapper($url,$page)
if($page==$this-currentPage()){
return$this-getActivePageWrapper($page);
return$this-getAvailablePageWrapper($url,$page);
*分页样式
protectedfunctioncss(){
return'styletype="text/css"
.paginationp{
margin:0;
cursor:pointer
.pagination{
height:40px;
padding:20px0px;
.paginationa{
display:block;
float:left;
margin-right:10px;
padding:2px12px;
border:1px#ccccccsolid;
background:#fff;
text-decoration:none;
color:#808080;
font-size:12px;
line-height:24px;
.paginationa:hover{
color:#009688;
background:white;
border:1px#009688solid;
.paginationa.cur{
border:none;
background:#009688;
color:#fff;
.paginationp{
float:left;
padding:2px12px;
font-size:12px;
line-height:24px;
color:#bbb;
border:1px#cccsolid;
background:#fcfcfc;
margin-right:8px;
.paginationp.pageRemark{
border-style:none;
background:none;
margin-right:0px;
padding:4px0px;
color:#666;
.paginationp.pageRemarkb{
color:red;
.paginationp.pageEllipsis{
border-style:none;
background:none;
padding:4px0px;
color:#808080;
.datesli{font-size:14
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 关于终止入股合同范例
- 10万吨煤矿合同范例
- 农村聘用教师合同范例
- 会计中合同范例
- 出租贴心公寓合同范例
- 分包管理合同范例
- 代办过户合同正式合同范例
- 借款生效合同范例
- 2024届重庆市九龙坡区杨家坪中学中考联考数学试题含解析
- 金融科技人工智能实验室行业跨境出海项目商业计划书
- 教研项目合同协议
- 图书馆笔试题及答案
- 贵州省贵阳市重点中学2024-2025学年高一年级下册开学考试语文试卷(含答案)
- 2025年山东省淄博市高新区中考一模历史试题(原卷版+解析版)
- 2025年高考数学压轴题分层练习:概率与统计(40题)
- 医院抹布拖把标识管理
- 2025年4月版安全法律法规标准文件清单
- 四川成都历年中考作文题与审题指导(2005-2024)
- 2025春季学期国开电大专科《管理学基础》一平台在线形考(形考任务一至四)试题及答案
- 公安规范化执法
- 2025年人工智能初创企业的组织架构与流程
评论
0/150
提交评论