keltiecochrane / themosis-pagination
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 not auto-updated.
Last update: 2022-02-01 13:08:54 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请求