djgadd / themosis-pagination
此包已被废弃,不再维护。未建议替代包。
简单的WordPress分页服务提供商。
1.0.3
2018-02-01 15:44 UTC
Requires
- php: >=7.0
- composer/installers: ~1.2
- djgadd/themosis-illuminate: ^1.0
- sunra/php-simple-html-dom-parser: ^1.5
This package is auto-updated.
Last update: 2021-10-15 21:19:07 UTC
README
Themosis框架的包,实现了一些基本的分页功能,使其更容易使用(而不是受WordPress的标记和类的限制。)
安装
通过composer安装:- composer require keltiecochrane/themosis-pagination
将config/pagination.config.php
复制到您的theme/resources/config
目录,并按需配置。
在您的theme/resources/config/providers.php
文件中注册服务提供者:- KeltieCochrane\Pagination\PaginationServiceProvider::class,
使用
调用辅助函数kc_pagination()
,它返回一个KeltieCochrane\Pagination\Pagination对象。该对象包含在Illuminate\Support\Collection对象中的分页导航项。您可以在分页对象上调用Collection方法,它们将被映射到底层Collection。分页类还实现了Countable、ArrayAccess和ArrayIterator,因此您可以更方便地与项目交互。
每个项都是一个数组,如下所示:-
[
'url' => bool|string, // Either the items URL or false if it doesn't have one.
'class' => string, // Classes to be applied to the item.
'text' => string, // The text for the item.
]
示例
/**
* Helper function that maps to app('pagination')->make($args, $query)
*
* @param null|array $args optional args, see codex paginate_links function reference
* @param null|\WP_Query $query optional query, by default will use global $wp_query
* @return \Illuminate\Support\Collection
*/
kc_pagination($args, $query = null);
支持
此包按原样提供,尽管我们会尽力提供帮助。
贡献
任何贡献都将受到鼓励和高度赞赏,您可以通过以下方式贡献:-
- 报告错误
- 建议功能
- 发送pull请求