georgringer / news

TYPO3 Extension news
GNU General Public License v2.0
264 stars 355 forks source link

News 9.2.0: pagination doesn't work with rewrite url for archived news #1715

Open gbartolucci opened 2 years ago

gbartolucci commented 2 years ago

When I use routing typo3's feature to rewrite URLs for archived news grouped by year and month the pagination doesn't work. I need to add addQueryStringMethod: 'GET' on f:uri.action helper in Partial/List/Pagination.html

georgringer commented 2 years ago

can you add some code to be able to reproduce it? thanks

georgringer commented 2 years ago

related to #1640

gbartolucci commented 2 years ago

config.yaml it's very similar to the typo3's examples

routeEnhancers:
  Novita:
    type: Extbase
    extension: News
    plugin: Pi1
    routes:
      -
        routePath: /
        _controller: 'News::list'
      -
        routePath: '/pagina-{page}'
        _controller: 'News::list'
        _arguments:
          page: 'currentPage'
      -
        routePath: '/visualizza/contenuto/{news-title}'
        _controller: 'News::detail'
        _arguments:
          news-title: news
      -
        routePath: '/archivio/{date-year}/{date-month}'
        _controller: 'News::list'
        _arguments:
          date-year: overwriteDemand/year
          date-month: overwriteDemand/month
      -
        routePath: '/archivio/{date-year}/{date-month}/pagina-{page}'
        _controller: 'News::list'
        _arguments:
          date-year: overwriteDemand/year
          date-month: overwriteDemand/month
          page: 'currentPage'
    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'
      date-month:
        type: StaticValueMapper
        map:
          gennaio: '01'
          febbraio: '02'
          marzo: '03'
          aprile: '04'
          maggio: '05'
          giugno: '06'
          luglio: '07'
          agosto: '08'
          settembre: '09'
          ottobre: '10'
          novembre: '11'
          dicembre: '12'

I redefined the Pagination.html page in another path, but if you change the row number 29 in Resources/Private/Templates/Styles/Twb/Partials/List/Pagination.html (for me the default) from <a href="{f:uri.action(action:actionName, arguments:{currentPage: page})}">{page}</a> to <a href="{f:uri.action(action:actionName, arguments:{currentPage: page}, addQueryString:1, addQueryStringMethod: 'GET')}">{page}</a>

it works. In News 8.5.2 version this parameter was present (in another widget but with the same function). For example, open the file Resources/Private/Templates/ViewHelpers/Widget/Paginate/Index.html and you'll find the parameter

dnlm commented 1 year ago

I'm experiencing the same problem, but the workaround (addQueryStringMethod: 'GET') doesn't seem to work for me 😞