分页不显示

Pagination is not displayed

我正在使用新闻系统扩展和 TYPO3 v9。

设置 routeEnhancers 后,分页在类别页面中完全隐藏。

即当 URL 是:example.com/cat/category-name 不显示分页,

并且当 URL 为:example.com/page?tx_news_pi1%5BoverwriteDemand%5D%5Bcategories%5D=13 时显示分页。

这是我的 config.yaml :

rootPageId: 1
routes: {  }
routeEnhancers:
NewsPlugin:
    type: Extbase
    extension: News
    plugin: Pi1
    routes:
        - { routePath: '/page/{page}', _controller: 'News::list', _arguments: {'page': '@widget_0/currentPage'} }
        - { routePath: '/{news_title}', _controller: 'News::detail', _arguments: {'news_title': 'news'} }          
        - { routePath: '/{category-name}', _controller: 'News::list', _arguments: {'category-name': 'overwriteDemand/categories'} }

    defaultController: 'News::list'
    defaults:
        page: '0'
    requirements:
        page: '\d+'
        news_title: '^[a-zA-Z0-9].*$'
    aspects:
        page:
            type: StaticRangeMapper
            start: '1'
            end: '100'

        category-name:
            type: PersistedAliasMapper
            tableName: sys_category
            routeFieldName: slug

        news_title:
            type: PersistedPatternMapper
            tableName: tx_news_domain_model_news
            routeFieldPattern: '^(?P<path_segment>.+)'
            routeFieldResult: '{path_segment}'

我解决了

确保:在您的 TS 上将 hidePagination 设置为 0:lib.news.settings.hidePagination = 0

这是我编辑后的config.yaml:

routes: {  }
routeEnhancers:
News:
type: Extbase
extension: News
plugin: Pi1
routes:
  - routePath: '/'
    _controller: 'News::list'

  - routePath: '/page-{page}'
    _controller: 'News::list'
    _arguments:
      page: '@widget_0/currentPage'

  - routePath: '/{news-title}'
    _controller: 'News::detail'
    _arguments:
      news-title: news

  - routePath: '/{category-name}/{page}'
    _controller: 'News::list'
    _arguments:
      category-name: 'overwriteDemand/categories'
      page: '@widget_0/currentPage'
    requirements:
      category-name: '\d+'
      page: '\d+'

defaultController: 'News::list'
defaults:
  page: '0'
aspects:
  news-title:
    type: PersistedAliasMapper
    tableName: tx_news_domain_model_news
    routeFieldName: path_segment
  page:
    type: StaticRangeMapper
    start: '1'
    end: '100'
  category-name:
    type: PersistedAliasMapper
    tableName: sys_category
    routeFieldName: slug

希望这有帮助