Typo3 类型3,新闻:通过get参数更改排序顺序和方向
在扩展新闻的列表视图中,我们需要更改排序顺序和排序方向的链接。是否有可能通过get参数更改这两个参数? 我取消选中了“禁用覆盖需求”选项,并尝试了一些组合,如Typo3 类型3,新闻:通过get参数更改排序顺序和方向,typo3,typo3-8.x,tx-news,Typo3,Typo3 8.x,Tx News,在扩展新闻的列表视图中,我们需要更改排序顺序和排序方向的链接。是否有可能通过get参数更改这两个参数? 我取消选中了“禁用覆盖需求”选项,并尝试了一些组合,如 ?tx_news_pi1[orderDirection]=asc ?tx_news_pi1[settings][orderDirection]=asc 但这不起作用 谢谢 不妨试试: tx_news_pi1[覆盖需求][订单方向]=asc (虽然我不确定orderDirection是否正确,但可以查看手册/代码)据我所知,流体模板中没有
?tx_news_pi1[orderDirection]=asc
?tx_news_pi1[settings][orderDirection]=asc
但这不起作用
谢谢 不妨试试:
tx_news_pi1[覆盖需求][订单方向]=asc
(虽然我不确定orderDirection是否正确,但可以查看手册/代码)据我所知,流体模板中没有包含排序的直观选项,因为所有排序都是在打字脚本和FlexForm的级别上完成的 尽管如此,有不同的选项可以从前端启用排序:
在任何情况下,您都应该使用始终附加并正确计算鸿沟的viewHelper创建用于排序的URL 打字稿:
#######
## Here you transfer the URL-parameters for sorting to the TypoScript-settings
## and also assure that only predefined values are accepted
#######
[globalVar = _GET|tx_news_pi1|orderBy = title]
plugin.tx_news.settings.orderBy = title
[globalVar = _GET|tx_news_pi1|orderBy = datetime]
plugin.tx_news.settings.orderBy = datetime
[globalVar = _GET|tx_news_pi1|orderBy = tstamp]
plugin.tx_news.settings.orderBy = tstamp
[globalVar = _GET|tx_news_pi1|orderBy = crdate]
plugin.tx_news.settings.orderBy = crdate
[global]
[globalVar = _GET|tx_news_pi1|sort = desc]
plugin.tx_news.settings.orderDirection = desc
[else]
plugin.tx_news.settings.orderDirection = asc
[global]
<f:link.action action="list" addQueryString="&tx_news_pi1[orderBy]=title&tx_news_pi1[sort]=asc">Sort by title: asc</f:link.action>
<f:link.action action="list" addQueryString="&tx_news_pi1[orderBy]=title&tx_news_pi1[sort]=desc">Sort by title: desc</f:link.action>
流体:
#######
## Here you transfer the URL-parameters for sorting to the TypoScript-settings
## and also assure that only predefined values are accepted
#######
[globalVar = _GET|tx_news_pi1|orderBy = title]
plugin.tx_news.settings.orderBy = title
[globalVar = _GET|tx_news_pi1|orderBy = datetime]
plugin.tx_news.settings.orderBy = datetime
[globalVar = _GET|tx_news_pi1|orderBy = tstamp]
plugin.tx_news.settings.orderBy = tstamp
[globalVar = _GET|tx_news_pi1|orderBy = crdate]
plugin.tx_news.settings.orderBy = crdate
[global]
[globalVar = _GET|tx_news_pi1|sort = desc]
plugin.tx_news.settings.orderDirection = desc
[else]
plugin.tx_news.settings.orderDirection = asc
[global]
<f:link.action action="list" addQueryString="&tx_news_pi1[orderBy]=title&tx_news_pi1[sort]=asc">Sort by title: asc</f:link.action>
<f:link.action action="list" addQueryString="&tx_news_pi1[orderBy]=title&tx_news_pi1[sort]=desc">Sort by title: desc</f:link.action>
按标题排序:asc
按标题排序:desc
此解决方案未经测试,可能仍需要对某些内容进行调整,但总体而言,它应该可以正常工作。与缓存相关的问题通常被认为与新闻记录相同,至少与任何必需的设置相关。
按其他字段排序需要执行以下步骤:
此外,您还可能在进一步搜索中发现另一个有用的扩展。如果是,请告诉我们;-)
考虑一下,如果使用分页,您可能还需要做一些调整,尤其是。我找到了问题的原因和解决方法 原因是flexform中的默认排序:按标题排序。GET参数orderBy无法覆盖flexform中的默认排序。如果在flexform中选择默认排序,则orderBy参数ist将被忽略,但orderDirection参数将按预期工作。结果令人困惑,但却是一致的:内容列表始终按默认排序,但排序方式不同 删除flexform中的默认排序后,所有工作按预期进行
我想这是一种虫子;我将在新闻的bug跟踪器中发布一个问题
tx\u news\u pi1[overwritedmand][order]=title desc
对我有效这不再有效(尽管以前有效)。您必须使用Georg Ringer已经提到的tx_news_pi1[OverwritedMand][order]=标题描述。