我正在使用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是:/ xxxxxxxxxxxxxxx期将引发错误
我如何限制扩展的路由。
您可以尝试使用参数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页上有效。