【问题标题】:Typo3 9 - routing - cHash in news listTypo3 9 - 路由 - 新闻列表中的 cHash
【发布时间】:2019-01-30 08:34:12
【问题描述】:

我将以下 config.yaml 用于标准新闻插件:

NewsPlugin:
  type: Extbase
  limitToPages:
    - 3
    - 15
  extension: News
  plugin: Pi1
  routes:
    -
      routePath: '/l/{page}'
      _controller: 'News::list'
      _arguments:
        page: '@widget_0/currentPage'
    -
      routePath: '/tag/{tag_name}'
      _controller: 'News::list'
      _arguments:
        tag_name: overwriteDemand/tags
    -
      routePath: '/{news_title}'
      _controller: 'News::detail'
      _arguments:
        news_title: news
    -
      routePath: '/archiv/{year}/{month}'
      _controller: 'News::archive'
  defaultController: 'News::list'
  defaults:
    page: '0'
    news_title: ''
    tag_name: ''
    year: '2019'
    month: '01'
  aspects:
    news_title:
      type: PersistedAliasMapper
      tableName: tx_news_domain_model_news
      routeFieldName: path_segment

现在一切都很好,唯一的问题是,当我使用分页时,我的网址总是附加一个 cHash。像链接到第 2 页的结果在

http://www.example.com/newspage/l/2?cHash=313213213213213a2f13asf321

任何想法为什么会发生这种情况?

【问题讨论】:

    标签: routing typo3 typo3-9.x


    【解决方案1】:

    如果requirements 太松或根本没有要求,将添加一个 cHash。也可以通过StaticRangeMapper 避免。

    我还在为新闻设置 routeEnhancers 而苦苦挣扎。您可以查看 my approach 以在不使用 cHash 的情况下应用分页。

    【讨论】:

    • 非常感谢,这正是我所需要的!成功了!
    【解决方案2】:

    感谢本,我找到了一个有效的解决方案:

    NewsPlugin:
      type: Extbase
      extension: News
      plugin: Pi1
      routes:
        -
          routePath: '/l/{page}'
          _controller: 'News::list'
          _arguments:
            page: '@widget_0/currentPage'
        -
          routePath: '/tag/{tag_name}'
          _controller: 'News::list'
          _arguments:
            tag_name: overwriteDemand/tags
        -
          routePath: '/{news_title}'
          _controller: 'News::detail'
          _arguments:
            news_title: news
        -
          routePath: '/archiv/{year}/{month}'
          _controller: 'News::archive'
      defaultController: 'News::list'
      defaults:
        page: '0'
        news_title: ''
        tag_name: ''
        year: '2019'
        month: '01'
      aspects:
        news_title:
          type: PersistedAliasMapper
          tableName: tx_news_domain_model_news
          routeFieldName: path_segment
        '@widget_0/currentPage':
          type: StaticRangeMapper
          start: '1'
          end: '1000'
    

    【讨论】:

    • 我刚刚尝试了您的新解决方案:从 /l/2(第 2 页)到第一页的分页器链接有很多获取参数,例如 ?tx_news_pi1%5Baction%5D=list&tx_news_pi1%5Bcontroller% 5D=新闻&cHash=123456789。它在您的环境中有效吗?
    猜你喜欢
    • 1970-01-01
    • 2020-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-13
    • 2014-02-10
    • 1970-01-01
    相关资源
    最近更新 更多