我使用的是TYPO3 V9.5.5和PHPV7.2.10。此外,还安装了tx-news插件。站点配置已设置并正常工作。但是如果我为新闻细节添加routeEnhancers,它不会在url中显示出来。它总是看起来像:http://p510984.mittwaldserver.info/aktuell/detail?tx_news_pi1%5Bnews%5D=5&cHash=c68f25c1ef4b5bd7320220373cfed332
我在stackoverflow和google中寻找解决方案。我还阅读了新闻扩展https://docs.typo3.org/typo3cms/extensions/news/stable/AdministratorManual/BestPractice/Routing/的手册
即使是TYPO3和PHP缓存刷新也没有帮助。
目前,我有以下代码:
routeEnhancers:
NewsPlugin:
type: Extbase
limitToPages:
- 17
extension: News
plugin: Pi1
routes:
- { routePath: '/{news_title}', _controller: 'News::detail', _arguments: {'news_title': 'news'} }
defaultController: 'News::list'
defaults:
page: '0'
aspects:
news-title:
type: PersistedAliasMapper
tableName: tx_news_domain_model_news
routeFieldName: path_segment是否需要"defaultController and defaults: page: 0"?
发布于 2019-04-18 20:38:17
正如Nitori在评论中提到的那样,您需要统一news_title / news-title的拼写。
但这似乎不是你唯一的问题。如果没有方面,您的URL至少应该如下所示:
http://p510984.mittwaldserver.info/aktuell/detail/5&cHash=c68f25c1ef4b5bd7320220373cfed332这意味着,整个路由当前不会应用于您的详细信息页面。
当您使用limitToPages时,请检查17是否为您的详情页的UID。
对于分页小部件、分类插件等,您需要将相关的页面UID添加到limitToPages,当然还需要扩展您的路由。The news documentation展示了这些用例的示例。
发布于 2020-01-06 22:06:23
这是我的配置,对我来说很好,也许这对我有帮助…
News:
type: Extbase
extension: News
plugin: Pi1
routes:
- routePath: '/'
_controller: 'News::list'
- routePath: '/page-{page}'
_controller: 'News::list'
_arguments:
page: '@widget_0/currentPage'
- routePath: '/{news-title}'
_controller: 'News::detail'
_arguments:
news-title: news
- routePath: '/{category-name}'
_controller: 'News::list'
_arguments:
category-name: overwriteDemand/categories
- routePath: '/{category-name}/page-{page}'
_controller: 'News::list'
_arguments:
category-name: overwriteDemand/categories
page: '@widget_0/currentPage'
defaultController: 'News::list'
defaults:
page: '0'
aspects:
news-title:
type: PersistedAliasMapper
tableName: tx_news_domain_model_news
routeFieldName: path_segment
page:
type: StaticRangeMapper
start: '1'
end: '100'
category-name:
type: PersistedAliasMapper
tableName: sys_category
routeFieldName: slug发布于 2021-02-08 21:42:44
对我来说,这个方法效果很好:
routeEnhancers:
# news rewrites
News:
type: Extbase
#limitToPages:
# - 67
extension: News
plugin: Pi1
routes:
- { routePath: '/{news-title}', _controller: 'News::detail', _arguments: { news-title: news } }
#- { routePath: '/cat/{news-cat}', _controller: 'News::list', _arguments: { news-cat: overwriteDemand/categories } }
defaultController: 'News::list'
defaults:
page: '0'
aspects:
news-title:
type: PersistedAliasMapper
tableName: tx_news_domain_model_news
routeFieldName: path_segment
news-cat:
type: PersistedAliasMapper
tableName: sys_category
routeFieldName: slughttps://stackoverflow.com/questions/55743425
复制相似问题