Reading data out of a flexform in typoscript - typo3

I try to read a flexform data out in typoscript. I tried it with several approaches, but none of them works correctly:
ajax.30 = TEXT
ajax.30.value = {$plugin.parser.settings.maxNumber}
ajax.40 < {$plugin.parser.settings.maxNumber}
ajax.50 < {$plugin.parser.settings.maxNumber}
ajax.60 = TEXT
ajax.60.data = {$field:flexform_varNum}
ajax.70 = TEXT
ajax.70.data = flexform : pi_flexform:settings.varNum
Can anyone give me a hint for the right syntax?
I'm using Typo3 9.5.13.

It is not possible to read out FlexForm data without an actual content element.
The CONTENT or COA objects would provide that. See for example Get FlexForm configuration in TypoScript
The feature was added in TYPO3 8.4 https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/8.4/Feature-17309-AccessFlexformValueViaTS.html

Related

How to show username in frontend in TYPO3 10?

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

TYPO3: Upload files to FAL with powermail

I am using powermail to allow a FE-User to edit a couple of fields of his own User-Record. Works fine, no hassle.
Now I would also like to allow the upload of a file. Is there a way to save the file to FAL with powermail? Unfortunately I have found no resources on this whatsoever. Maybe it is possible to implement a userfunc when saving to DB that would generate the required DB entries? When using powermails "upload"-field-type the file gets written to uploads/tx_powermail. I have access to that files path in my db_entry step in typoscript and could pass it on to a userfunc - which in return should
generate the sys_file entry
delete a possiblibly already existing sys_file_reference
generate the new sys_file_reference
Am I missing something?
Any ideas on this? Has anyone done something like this before?
Or is my only alternative to switch from powermail to a custom extbase extension?
System: TYPO3 7.6.16, Powermail 3.17
Thanks
I have same problems in powermail and i use powermail Finisher class like below.
TYPOSCRIPT:
plugin.tx_powermail.settings.setup {
finishers {
1 {
class = Vendor\Ext\Finisher\AddImageFinisher
config {
# set pid.
pid = TEXT
pid.value = 79 // Here
#set powermail fields title
field_name = Name
field_place = Place
field_email = E-Mail
field_message = Message
}
}
}
}
Please reffere this link. AddImageFinisher Class file
At the moment powermail don't uses FAL relations. If you need something like this, you have to add an own finisher that does the upload stuff - see https://docs.typo3.org/typo3cms/extensions/powermail/ForDevelopers/AddFinisherClasses/Index.html
Just for the record. TYPO3 8 core ships a new form extension which allows both. With the save to database finisher you can easily edit fe_user data. Furthermore, all image uploads are handled as FAL. We will document this use case and release a small extension which does the job (soon).

How force a template file in tt_news LIST?

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.

Use Powermail in Typo3 6.2.4

I'm using typo3 6.2.4 and powermail 2.0.16
I need to create a form who send a mail to me.
I created the form with the page and the fields. One is the name and one is the mail to test.
After, I created the content element with the plugin powermail and now, I need to display the form in the frontend. I have active the static "Main Template" and "Add basic CSS". I try this code but it's not working.
page = PAGE
page.10 = CONTENT
page.10.table = tt_content
page.10.select {
where = colPos = 0
orderBy = sorting
}
page.10.renderObj = COA
page.10.renderObj {
10 = TEXT
10.field = header
10.wrap = <div class="header">|</div>
20 = TEXT
20.field = bodytext
20.wrap = <div class="bodytext">|</div>
}
Can you help me?
The answer is here : Nothing appears in Typo3 with powermail (Frontend)
It seems that you are missing the proper typoscript to actually show the form on the page. The specified typoscript snippet is not enough to show the content elements on the page.
Inside your typoscript template include the css_styled_content static template and change the snippet to this:
# Default PAGE object:
page = PAGE
page.10 < styles.content.get
That should ensure proper showing on the frontend. This is basic as it is, if you want it to be better looking, or different templating you should take a look at templating with TYPO3 first.
Just thinking with you here, did you add this as a template in the typoscript template configuration? Like

TYPO3 Content Element in TYPO3 6.0.1

I use the Content Element in my Typoscript. The take a Image from a Folder. I mad this 1000 times in older TYPO3 Versions.
This is mi Code
lib.test = CONTENT
lib.test{
table = tt_content
select{
uidInList=4
pidInList=2
}
}
The Folder ID's are correct.
I mapped the test with Templavoila in a div(inner)
We've had the same issue and ported back to Typo3 4.7.x. TemplaVoila and also a lot other extensions still have problems working correctly in 6.x
Try below one;
lib.logo = RECORDS
lib.logo{
tables = tt_content
source = 123 #Respected Content Element ID
}