在 TYPO3 9 中,我设法使用以下 Typoscript 在 FLUID 模板中显示当前用户名:
[loginUser=*]
temp.username = TEXT
temp.username {
insertData = 1
value = {TSFE:fe_user|user|username}
noTrimWrap = | ||
}
[global]
Run Code Online (Sandbox Code Playgroud)
在 TYPO3 10.4 中,这不再起作用。知道如何显示当前用户吗?非常感谢!乌尔
在 Typo3 V10 中,你必须使用 Context API 从全局对象中检索数据,试试这个:
[frontend.user.isLoggedIn]
temp.username = TEXT
temp.username.data = TSFE:fe_user|user|name
temp.username.wrap = |
[global]
Run Code Online (Sandbox Code Playgroud)
看看这些链接:
https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/DataTypes/Index.html https://docs.typo3.org/m/typo3/reference-coreapi/master/en -us/ApiOverview/Context/Index.html#context-api
弗洛里安