【发布时间】:2019-12-09 08:52:13
【问题描述】:
我在 TYPO3 9.5.11 上使用新闻扩展和无限滚动插件时遇到问题。
我正在寻找的是设置 2 个无限滚动:一个列出每条新闻,另一个按类别列出新闻(使用按类别列表)。它有效,但是当我按类别列出我的新闻时,我无法获得像其他滚动条中那样的可读 URL(例如,我得到的是 *categorie/page-2?tx_news_pi1[action]=list&tx_news_pi1[controller]=News&tx_news_pi1[overwriteDemand][categories]=3&cHash=6ff5f6ee014fec754b5453d9c4afdcc1* 而不是 categorie/nameofthecategory/page-X)。我希望它足够清楚。
这是我的 config.yaml :
routeEnhancers:
News:
type: Extbase
extension: News
plugin: Pi1
routes:
-
routePath: '/{news-title}'
_controller: 'News::detail'
_arguments:
news-title: news
-
routePath: '/{category-name}'
_controller: 'News::list'
_arguments:
category-name: overwriteDemand/categories
-
routePath: '/{tag-name}'
_controller: 'News::list'
_arguments:
tag-name: overwriteDemand/tags
defaultController: 'News::list'
defaults:
page: '0'
aspects:
news-title:
type: PersistedAliasMapper
tableName: tx_news_domain_model_news
routeFieldName: path_segment
category-name:
type: PersistedAliasMapper
tableName: sys_category
routeFieldName: slug
tag-name:
type: PersistedAliasMapper
tableName: tx_news_domain_model_tag
routeFieldName: slug
NewsList:
type: Plugin
routePath: '/page-{@widget_0/currentPage}'
namespace: 'tx_news_pi1'
aspects:
'@widget_0/currentPage':
type: StaticRangeMapper
start: '1'
end: '1000'
有人知道如何设置吗?
谢谢! :-)
编辑:好的,所以我发现使用这个 config.yaml 有点工作:
routeEnhancers:
News:
type: Extbase
extension: News
plugin: Pi1
routes:
-
routePath: '/{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}'
_controller: 'News::list'
_arguments:
category-name: overwriteDemand/categories
page: '@widget_0/currentPage'
defaultController: 'News::list'
defaults:
page: '1'
requirements:
page: '\d+'
aspects:
news-title:
type: PersistedAliasMapper
tableName: tx_news_domain_model_news
routeFieldName: path_segment
category-name:
type: PersistedAliasMapper
tableName: sys_category
routeFieldName: slug
page:
type: StaticRangeMapper
start: '1'
end: '100'
这个设置的问题是我遇到了这里解释的错误:Bug #86895 - routeEnhancer not working correct for paginate widget。这意味着在我的主页上,如果我输入 url */2 并加载第一页,我会得到一个不正确的 URL。无论出于何种原因,我都没有在我的类别过滤页面中遇到它......
我尝试申请the patch mentionned in Forge,可惜没有成功。
【问题讨论】:
标签: php routing typo3 typo3-9.x tx-news