t3brightside / paginatedprocessors
为 TYPO3 的分页数据处理器
1.6.4
2024-07-20 15:32 UTC
Requires
- t3brightside/embedassets: ^1.3
- typo3/cms-core: ^11.5 || ^12.4 || ^13.0
README
支持分页的 TYPO3 CMS 数据处理器
系统需求
- TYPO3 v11, v12, v13
特性
- PaginatedDatabaseQueryProcessor
- PaginatedFilesProcessor
- PaginatedMenuProcessor
- 分页开关
- 每页项目数量
- 分页链接数量
- 从内容元素或 TypoScript 的 URL 段
- 锚链接到内容元素或自定义 ID
安装与更新
composer req t3brightside/paginatedprocessors
或从 TYPO3 扩展仓库 paginatedprocessors- 包含静态模板
- 在常量编辑器中启用默认 CSS: paginatedprocessors.enableDefaultStyles = 1
- 查看变更日志以了解更新和重大更改
用法
可用的 DataProcessors
Brightside\Paginatedprocessors\DataProcessing\PaginatedDatabaseQueryProcessor
Brightside\Paginatedprocessors\DataProcessing\PaginatedFilesProcessor
Brightside\Paginatedprocessors\DataProcessing\PaginatedMenuProcessor
TypoScript 示例
10 = Brightside\Paginatedprocessors\DataProcessing\PaginatedDatabaseQueryProcessor
10 {
pagination {
isActive = 1
# isActive.field = tx_paginatedprocessors_paginationenabled
itemsPerPage = 10
itemsPerPage.override.field = tx_paginatedprocessors_itemsperpage
pageLinksShown = 7
pageLinksShown.override.field = tx_paginatedprocessors_pagelinksshown
## configure anchor links
# anchorActive = 1
anchorActive.field = tx_paginatedprocessors_anchor
## set element uid manually
# anchorId = 123
## or current content element from uid field
anchorId.field = uid
# content uid overriden if custom anchor element set in pagination options
anchorId.override.field = tx_paginatedprocessors_anchorid
## uniqueId is mandatory
## returns array 'pagination'
## URL example /21/2
uniqueId.field = uid
uniquePaginatorName = 0
## returns array 'pagination'
## URL example /gallery/2
## need to map in routeEnhancers, see PaginatedprocessorsByUnigueIdInTs
# uniqueId = gallery
## returns array 'pagination_gallery'
## URL example /gallery/2
## need to map in routeEnhancers, see PaginatedprocessorsByUnigueIdInTs
# uniqueId = gallery
# uniquePaginatorName = 1
}
...
}
分页链接控制示例
pageLinksShown = 1
[<<][<][-4/12-][>][>>]
pageLinksShown = 0 or is bigger than amount of pages + 2
[<][1][2][-3-][4][5][>]
pageLinksShown = 5
[<][1]…[5][6][-7-][8][9]…[60][>]
模板
<f:for each="{pages}" as="page" iteration="iterator"> <f:render partial="List" arguments="{_all}" /> </f:for> <f:if condition="{pagination.numberOfPages} > 1"> <f:render partial="Pagination" arguments="{pagination:pagination}" /> </f:if> <!-- with uniquePaginatorName turned on --> <f:if condition="{pagination_gallery.numberOfPages} > 1"> <f:render partial="Pagination" arguments="{pagination:pagination_gallery}" /> </f:if>
路由增强器
imports: - resource: EXT:paginatedprocessors/Configuration/Routes.yaml
在自己的扩展中
向自定义内容元素添加分页字段
# There's a palette available to use for tt_content
--palette--;Pagination;paginatedprocessors,
分页自定义数据处理器
请参阅: PaginatedDatabaseQueryProcessor.php