Download the PHP package tianhe1986/fatpagination without Composer

On this page you can find all versions of the php package tianhe1986/fatpagination. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package fatpagination

安装

确保PHP版本在5.5以上。

推荐通过Composer进行安装

Composer的安装请参考官方配置。

安装好Composer后,在你的项目中创建一个 composer.json 文件:

然后在项目文件夹下执行:

之后添加autoloader:

分页处理

简单的用法示例如下:

$urlHtml对应如下html代码:

$divHtml对应如下html代码:

默认情况下,会使用page作为分页的参数,当前页码会加上class="active",当前页左右最多各展示3个数字页码。可以通过传入参数更改这些配置,具体的参数列表见下一小节。

传入参数

所有支持的参数列表如下:

参数名 说明
pageParam 分页的参数名,默认为 page
url 分页的url,不设置的话默认为当前url,会自动去除query_string中的分页参数部分
totalNum 数据总条数
pageSize 每页数据展示条数,默认为10
currentPage 当前页码,默认为1
sidePageNum 当前页码左右两边最多展示多少个数字页码。以设置为2举例, 当前页码为1,则展示 1 2 3,如果当前页码为2,则展示 1 2 3 4, 为3则展示 1 2 3 4 5
prevPageText 上一页链接展示文本, 默认为“上一页”
nextPageText 下一页链接展示文本, 默认为“下一页”
firstPageText 首页链接展示文本, 默认为“首页”
lastPageText 末页链接展示文本, 默认为“末页”
attrs 数组,给标签附加的额外属性,具体参数见下表

所有attrs参数列表如下:

参数名 说明
div div标签附加属性,仅生成div列表时有效
ul ul标签附加属性,仅生成ul列表时有效
a 非当前数字页码a标签附加属性,仅div列表有效
li 非当前数字页码li标签附加属性,仅ul列表有效
currentPage 当前数字页码附加属性,div列表附加在a标签上,ul列表附加在li标签上。 默认会附加 class="active"
prevPage 上一页附加属性,div列表附加在a标签上,ul列表附加在li标签上
nextPage 下一页附加属性,div列表附加在a标签上,ul列表附加在li标签上
firstPage 首页附加属性,div列表附加在a标签上,ul列表附加在li标签上
lastPage 末页附加属性,div列表附加在a标签上,ul列表附加在li标签上

以下是包含全部参数的ul列表生成示例:

将生成

div列表生成示例:

将生成

自行构造分页html

如果提供的参数依旧不能满足需要,可以按照如下方式,获取首/末页,上/下一页,以及数字页码,然后自行拼接html:

则最终$html为:


All versions of fatpagination with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tianhe1986/fatpagination contains the following files

Loading the files please wait ....