【发布时间】:2019-02-13 15:28:49
【问题描述】:
在使用带有自定义扩展的路由增强器时,我想去掉 cHash get 参数。
TYPO3 文档/变更日志假设这是可能的:
如果你真的要求永远不要有 cHash 参数, 确保所有占位符对什么都有严格的定义 可能是页面段的结果...
但严格定义究竟是什么意思。
这是我的路由配置:
routeEnhancers:
ExecutiveSearchResultList:
type: Extbase
extension: executivesearch
plugin: searchresultlist
routes:
- { routePath: '/list/{page}', _controller: 'Search::searchResultList', _arguments: {'page': 'page'} }
defaultController: 'Search::searchResultList'
defaults:
page: '1'
action: 'searchResultList'
controller: 'Search'
requirements:
page: '\d+'
结果是
/path/to/my-page/list/1?cHash=6cd242916809d29b799debe824b37fcd
我还有一个 tx_news 的路由,可以正常工作,不要附加 cHash:
NewsPlugin:
type: Extbase
extension: news
plugin: Pi1
routes:
- { routePath: '/list/{page}', _controller: 'News::list', _arguments: {'page': '@widget_0/currentPage'} }
- { routePath: '/tag/{tag_name}', _controller: 'News::list', _arguments: {'tag_name': 'overwriteDemand/tags'}}
- { routePath: '/news/{news_title}', _controller: 'News::detail', _arguments: {'news_title': 'news'} }
- { routePath: '/archive/{year}/{month}', _controller: 'News::archive' }
defaultController: 'News::list'
aspects:
news_title:
type: PersistedAliasMapper
tableName: 'tx_news_domain_model_news'
routeFieldName: 'path_segment'
defaults:
page: '0'
requirements:
page: '\d+'
【问题讨论】:
-
stackoverflow.com/a/53054351/923560 通过使用返回与路由提供的值相同的映射器提供了一种解决方法。它使 cHash 消失。