![](/img/trans.png)
[英]How to configure speaking URL of tx_blog extension in TYPO3 9.x
[英]How to configure the routeEnhancers in Typo3 9?
我正在使用typo3 9,5 并且我正在尝试从扩展生成路由。 一切正常,直到我发现只要 URL 多,路由的参数就会导致错误
例子:
testRoute:
type: Extbase
extension: testExtension
plugin: testMain
routes:
- { routePath: '/test/info/{name}/{period}', _controller:
'content::info', _arguments: {'name': 'name','period': 'period'} }
defaultController: 'content::info'
aspects:
# here we get the needed information for a nice URL for _arguments
name:
type: PersistedAliasMapper
tableName: 'xx'
routeFieldName: slug
period:
type: PersistedAliasMapper
tableName: 'xx'
routeFieldName: slug
该路线工作正常。 问题:如果我有任何页面以句点作为名称(testperiod)typo3 尝试生成我定义的 testRoute
Error
Parameter "tx_testextension_info__period" for route "tx_testextension_info_0" must
match
"[^/]++" ("" given) to generate a corresponding URL.
即使 URL 是:/xxxxxxxxxxxxxxxperiod 也会抛出错误
如何限制扩展的路由。
您可以尝试使用参数 limitToPages 限制路由对指定页面的影响。 例子 :
NewsList:
type: Plugin
limitToPages: [3]
routePath: '/{@widget_0/currentPage}'
namespace: 'tx_news_pi1'
aspects:
'@widget_0/currentPage':
type: StaticRangeMapper
start: '1'
end: '1000'
在这个例子中,我的路线只会在第 3 页上工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.