如何使用路由增强器摆脱 cHash?
How to get rid of the cHash with routing enhancers?
我想在使用带有自定义扩展的路由增强器时获取 cHash get 参数的 rifd。
TYPO3 docs/changelog假设这是可能的:
If you really have the requirement to never have a cHash argument,
ensure that all placeholders are having strict definitions on what
could be the result of the page segment ...
但是严格定义到底是什么意思。
这是我的路由配置:
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+'
我的解决方法是 StaticRangeMapper。
提示:1000 是目前 TYPO3 核心中的最大值。
NewsPlugin:
type: Extbase
limitToPages:
- 56
extension: News
plugin: Pi1
routes:
- routePath: '/list/{page}'
_controller: 'News::list'
_arguments:
page: '@widget_0/currentPage'
- routePath: '/detail/{news_title}'
_controller: 'News::detail'
_arguments:
news_title: news
defaultController: 'News::list'
defaults:
page: '0'
requirements:
page: \d+
aspects:
page:
type: StaticRangeMapper
start: '1'
end: '1000'
news_title:
type: PersistedAliasMapper
tableName: tx_news_domain_model_news
routeFieldName: path_segment
我想在使用带有自定义扩展的路由增强器时获取 cHash get 参数的 rifd。
TYPO3 docs/changelog假设这是可能的:
If you really have the requirement to never have a cHash argument, ensure that all placeholders are having strict definitions on what could be the result of the page segment ...
但是严格定义到底是什么意思。
这是我的路由配置:
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+'
我的解决方法是 StaticRangeMapper。
提示:1000 是目前 TYPO3 核心中的最大值。
NewsPlugin:
type: Extbase
limitToPages:
- 56
extension: News
plugin: Pi1
routes:
- routePath: '/list/{page}'
_controller: 'News::list'
_arguments:
page: '@widget_0/currentPage'
- routePath: '/detail/{news_title}'
_controller: 'News::detail'
_arguments:
news_title: news
defaultController: 'News::list'
defaults:
page: '0'
requirements:
page: \d+
aspects:
page:
type: StaticRangeMapper
start: '1'
end: '1000'
news_title:
type: PersistedAliasMapper
tableName: tx_news_domain_model_news
routeFieldName: path_segment