In TYPO3 9 I managed to display the current username in a FLUID-template with the following Typoscript:
[loginUser=*]
temp.username = TEXT
temp.username {
insertData = 1
value = {TSFE:fe_user|user|username}
noTrimWrap = | ||
}
[global]
In TYPO3 10.4 this is not working anymore. Any idea how to display the current user?
Many thanks! Urs
In Typo3 V10, you have to use the Context API to retrieve data from global objects, try this :
[frontend.user.isLoggedIn]
temp.username = TEXT
temp.username.data = TSFE:fe_user|user|name
temp.username.wrap = |
[global]
Have a look at those links :
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
Florian
It's probably not working because you're using the old TypoScript conditions. Since TYPO3 9 the conditions work with Symfony expressions. The old conditions were deprecated in TYPO3 9 (but still worked) and removed in TYPO3 10. So [loginUser=*] will never be true in TYPO3 10. You should use [frontend.user.isLoggedIn] instead.
See https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Conditions/Index.html for more about the new TypoScript conditions.
Why use TypoScript? It is very limited on what it can bring back. I just finished a tutorial where you can use a ViewHelper to add an ExtBase variable which assigns the whole user object in the FrontEnd and you can use it wherever you want with all it's relations, even the image, which is difficult to get via TypoScript.
TYPO3 tutorial
Best regards
Related
I am currently updating a website from Typo3 7 to Typo3 9. The Website includes a Sitemap, which I would like to also show pages that are marked as "Not in Menus". On the old version, this could be achieved usnig the following bit of typoscript:
tt_content.menu.20.2.includeNotInMenu = 1
tt_content.menu.20.2.excludeDoktypes = 6
This, however does not work anymore in v9 and I can't find any help on Google.
TYPO3 9 uses fluid_styled_content to render content instead of css_styled_content. The sitemap is rendered using a MenuProcessor. These same options are available in the MenuProcessor. You can set them using the following TypoScript:
tt_content.menu_sitemap.dataProcessing.10 {
includeNotInMenu = 1
excludeDoktypes = 6
}
The above solutions did not work for me. I am using Typo3 9.5.19
The following worked:
Add to constants
plugin.tx_seo.settings.xmlSitemap.sitemaps.pages.additionalWhere = no_index = 0 AND canonical_link = '' AND nav_hide = 0
Note: This does stop sub pages under a hidden page. all pages needs to be marked hidden
I have a list in tt_news and use many folders with tt_news records. I want to use a different template in this list when I filter and display specific category.
My Typoscript is:
[globalVar = GP:tx_ttnews|place|0 = 79]
#Display list of specific category
plugin.tt_news.templateFile = fileadmin/templates/plugins/tt_news/different.html
[else]
#General display list
plugin.tt_news.templateFile = fileadmin/templates/plugins/tt_news/general.html
[end]
I have used plugin.tt_news.templateFile and plugin.tt_news.file.templateFile but don't work. I am using the last version of tt_news and TYPO3 6.2
"plugin.tt_news.templateFile" is right, i think there is a problem in "[globalVar = GP:tx_ttnews|place|0 = 79]" you should close global with "[global]" instead of "[end]". Try this if it is helpful to you.
For the Typoscript way did not resolve this, I do not why? For we needed we have use a category and marker in the template of tt_news and create a logic in frontend through JS for resolve this.
How is it possible to set in Page TSConfig the default value for "Number of Columns" in TYPO3 V7.6? In erlier versions it was possible with TCEFORM.tt_content.imagecols = 1. If I set in V7.6 TCEFORM.tt_content.imagecols = 1 it makes no different which value is set. There is always imagecols = 2 set.
I have PHP 7.0.7 and use the rendering extension fluid_styled_content (not css_styled_content). Is there something I am missing?
Thanks in advance for your help.
TCAdefaults.tt_content.imagecols = 1
works for me in TYPO3 7.6.11
TCEFORM.tt_content.imagecols.config.default = 1 is not working, as described op.
Be aware: This config never works if you switch content type after saving a content:
https://forge.typo3.org/issues/75233
In TYPO3 (7.2.0) using the standard template engine, is there a way to add a placeholder attribute to the standard mail form text input?
At the moment I am using JavaScript to convert the labels into placeholders, but I am open to suggestions on a better way to do this...
The suggested solution of #biesior does only work for EXT:form 7.4 and higher (see changelog). The supplied picture shows the form wizard of TYPO3 7.5 or 7.6. In 7.2 you won't find any placeholder attribute in the wizard.
I recommend updating to TYPO3 7.6 since this version includes a major rewrite of EXT:form. You will be able to use fluid templates to customize your forms. Furthermore HTML5 attributes are possible. Before the rewrite the set of allowed attributes was quite limited. Now you are able to add all attributes you can think of (for example "data-"). See changelog.
If you have any questions regarding EXT:form join the channel on Slack. If you don't know Slack yet, check out the invite function.
During form fields editing you have many properties, also Placeholder
in text version it will be:
10 = TEXTLINE
10 {
type = text
class = foo-class
id = foo-id
name = foo
placeholder = Hmmm?
required = required
label {
value = My Field
}
}
I have a page running TYPO3 4.5.x that has a singleview of a plugin (plugin.tx_browser). I would like the default pivar showUid to be the uid of the currently logged in user.
I can get the uid in typoscript with
data = TSFE:fe_user|user|uid
And I know I can set the piVar to a fixed value with
plugin.tx_browser_pi1._DEFAULT_PI_VARS.showUid = 575
but i can not set
plugin.tx_browser_pi1._DEFAULT_PI_VARS.showUid.data = TSFE:fe_user|user|uid
Is there a way to set the pivar thorugh typoscript dynamically?
The suggestion to use the stdWrap property unfortunately does not seem to work prior to TYPO3 6.2
Thanks
It's possible since Version 6.2. You just need to add the stdWrap property:
plugin.tx_browser_pi1._DEFAULT_PI_VARS.showUid.stdWrap.data = TSFE:fe_user|user|uid
See the the corresponding part in the TypoScript Reference.