Syb*_*ers 3 typo3 tx-news typo3-9.x
我逐字使用了Changelog 中的示例:
我唯一改变的是limitToPages。
routeEnhancers:
NewsPlugin:
type: Extbase
limitToPages: [82]
extension: News
plugin: Pi1
routes:
- { routePath: '/{news_title}', _controller: 'News::detail', _arguments: {'news_title': 'news'} }
defaultController: 'News::detail'
aspects:
news_title:
type: PersistedAliasMapper
tableName: 'tx_news_domain_model_news'
routeFieldName: 'path_segment'
routeValuePrefix: '/'
Run Code Online (Sandbox Code Playgroud)
这会在 9.5.4 中引发异常:
Symfony\Component\Routing\Exception\InvalidParameterException
Parameter "tx_news_pi1__news" for route "tx_news_pi1_0" must match "[^/]++" ("" given) to generate a corresponding URL.
in /var/www/example/htdocs/typo3_src-9.5.4/vendor/symfony/routing/Generator/UrlGenerator.php line 155
at Symfony\Component\Routing\Generator\UrlGenerator->doGenerate(array('tx_news_pi1__news' => 0), array('_controller' => 'News::detail'), array(), array(array('variable', '/', '[^/]++', 'tx_news_pi1__news', true), array('text', '/aktuelles/artikel')), array('tx_news_pi1__news' => ''), 'tx_news_pi1_0', 1, array(), array())
in /var/www/example/htdocs/typo3_src-9.5.4/vendor/symfony/routing/Generator/UrlGenerator.php line 128
Run Code Online (Sandbox Code Playgroud)
目前,不存在其他路由增强剂。但是我在完全相同的页面上成功地使用了一个更简单的配置并且有效:
NewsDetail:
type: Extbase
limitToPages: [82]
extension: News
plugin: Pi1
routes:
- { routePath: '/{news_id}', _controller: 'News::detail', _arguments: {'news_id': 'news'} }
Run Code Online (Sandbox Code Playgroud)
不确定在哪里查看以及如何最好地排除故障。我希望有人有类似的问题,或者可以指出我正确的方向。
检查空 path_segment 是否是这里的问题:
select count(*) from tx_news_domain_model_news where path_segment='';
Run Code Online (Sandbox Code Playgroud)
如果有空标题的新闻条目,您可能需要先删除这些或更新标题。