in an own, individual content element i use inline records. Output in fluid templates is realized with this data processor:
20 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
20 {
table = tx_mytable
pidInList.field = pid
where {
data = field:uid
intval = 1
wrap = tt_content=|
}
orderBy = sorting
}
For text fields this works as expected but not for media or images. Media or images are inline records themselves - inline records in inline records ...
Is there a possibility to get the records of media or image fields in inline records?
This does not work obviously:
30 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
30 {
references.fieldName = media
as = files
}
It works only with media or image in the main record not in linked inline records. Backend and TCA works as expected, the linked media in the linked inline records are shown correctly. But in fluid i get only [media] = 1.
Any idea how to solve this problem?
Well i found the solution: it is possible to nest data processors:
20 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
20 {
table = tx_mytable
pidInList.field = pid
where {
data = field:uid
intval = 1
wrap = tt_content=|
}
orderBy = sorting
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10 {
references.fieldName = media
as = files
}
}
}
This works.
Related
I'm not very familiar with data processing and I'm stuck. I created a new field customer_id in the table tt_content, in which the uid of a tt_address record is stored.
Now I need to read that customer_id from tt_content and fetch the associated record from tt_address to display name and company of it in the fluid template.
tt_content.customerdata =< lib.contentElement
tt_content.customerdata {
templateName = Kundeninfo
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
table = tt_content
uidInList.field = customer_uid
fieldName = customer_uid
???
as = customer
}
}
}
Update:
It woks with
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
if.isTrue.field = customer_uid
table = tt_content
selectFields = tt_address.*
join = tt_address ON tt_address.uid IN(tt_content.customer_uid)
where = tt_content.uid = 568
as = customer
}
One last problem
In tt_content only one customer_uid (related to the uid of tt_address) is saved for some elements. The above code selects all addresses whose uids are stored in tt_conent. Now i need to get only the matching address to the elements form tt_content. I tested it with one uid of a content element (568) in the code above, that works.
Now i don't know how to code the where condition to read the associated record from tt_address to every content element that has a customer_uid
Thanks
I'm new to TYPO3 and Fluid. I want to generate a dynamic PDF through a button.
My problem is I don't know how to get my products with their uid.
All of them have a uid. My question is how can I display them in my frontend using fluid code?
If I try to access the product data with cObject Records I get the error "Table doesnt exists"
So I figured out cObject uses the database thats why I get the "Table doesnt exist" error
But thats not what I want. I want to get the data out of the backend records.
TypoScript:
lib.fluidLoadRecord = RECORDS
lib.fluidLoadRecord {
source.data = current:1
source.intval = 1
dontCheckPid = 1
tables = product
}
Fluid:
{f:cObject(typoscriptObjectPath: 'lib.fluidLoadRecord', data: '69')}
<!--<v:page.resources.fal table="product" uid="69">
<pdf:text>{product.description}</pdf:text>
</v:page.resources.fal>-->
Any help would be appreciated.
Are you really sure that the table is called product and not something like tx_product_domain_model_item. You can e.g. check the source code of the input field ProductSeries and you will see something like that
data-formengine-input-name="data[be_groups][1][title]"
In my example the table would be be_groups.
For the rendering you need some more code like this
lib.fluidLoadRecord = RECORDS
lib.fluidLoadRecord {
source.data = current:1
source.intval = 1
dontCheckPid = 1
tables = tx_your_db_table_name
conf.tx_your_db_table_name = COA
conf.tx_your_db_table_name {
10 = TEXT
10 {
field = producseries
htmlspecialchars = 1
wrap = <h1>|</h1>
}
}
So as already provided in this post here is the solution.
It is not possible to access data directly from the backend.
It is only possible through the database tables.
lib.fluidLoadRecord0 = RECORDS
lib.fluidLoadRecord0 {
source.data = current:1
source.intval = 1
dontCheckPid = 1
tables = tx_bmyproducts_domain_model_product
conf.tx_bmyproducts_domain_model_product = TEXT
conf.tx_bmyproducts_domain_model_product.field = producseries
}
And here how to use it with cObject
<f:cObject typoscriptObjectPath="lib.fluidLoadRecord0">69</f:cObject>
And if you want to join some tables and display them you can use something like that.
lib.productfamily = CONTENT
lib.productfamily {
table = tx_bmyproducts_domain_model_product
select {
uidInList = 69
pidInList = 369
selectFields = title
join = tx_bmyproducts_domain_model_productfamily on
tx_bmyproducts_domain_model_productfamily.cruser_id =
tx_bmyproducts_domain_model_product.cruser_id
where = tx_bmyproducts_domain_model_product.uid
}
renderObj = TEXT
renderObj {
field = title
}
}
Then you can display the data with cObject.
I have a list with content uids from a mask custom content element. The editor can choose some content elements from a list. And now I want the complete data from these content element uids. So I tried DatabaseQueryProcessor.
I am trying with DataProcessing for the first time.
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
table = tt_content
uidInList.field = tx_mask_sectionmenu_contentitems
as = items
}
}
This almost works, but the order in fluid output does not match the order of the original list. How can I force the same order for the fluid output as in the original list?
Or do I have to go over the SplitProcessor first?
This SplitProcessor works so far, but I don’t know what to specify in the next DatabaseQueryProcessor?
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\SplitProcessor
10 {
if.isTrue.field = tx_mask_sectionmenu_contentitems
delimiter = ,
fieldName = tx_mask_sectionmenu_contentitems
removeEmptyEntries = 1
filterIntegers = 0
filterUnique = 1
as = items
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
table = tt_content
???
as = contentItem
}
}
}
}
The sorting field is not what I want. I want the same sorting like the editor has selected.
How can I solve this?
As far as I can see, the SplitProcessor does not support any further dataProcessing like other DataProcessors (at least if haven't noticed any dataProcessing on the list of options like for others): https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/ContentObjects/Fluidtemplate/DataProcessing/SplitProcessor.html
Here is a workaround, that also works with TYPO3 11:
https://forge.typo3.org/issues/86151
In short:
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
table = tt_content
uidInList.field = tx_mask_sectionmenu_contentitems
selectFields.dataWrap = *,FIND_IN_SET(uid,'{field:pages}') AS foobar_sort
orderBy = foobar_sort
as = contentItem
}
}
I tested uidInList.field = tx_mask_sectionmenu_contentitems but it doesn't helped to get the records sorted by the order of the comma-separated uid list.
The nested approach doesn't worked at all. I had a look in the code and found that only DatabaseQueryProcessor, LanguageMenuProcessor and MenuProcessor are able to process the content with another MenuProcessor.
According to https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/ContentObjects/Fluidtemplate/Index.html#dataprocessing
# All properties from .select can be used directly
# + stdWrap
colPos = 1
pidInList = 13,14
and checking the select properties https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Functions/Select.html gives you
uidInList =
pidInList =
recursive =
orderBy =
groupBy =
max =
begin =
where =
languageField =
includeRecordsWithoutDefaultTranslation =
selectFields =
join =
leftjoin =
rightjoin =
So instead of using nested dataProcessing here, you might want to skip orderBy and go for uidInList instead.
uidInList.field = tx_mask_sectionmenu_contentitems
If you want to stay with the nested approach, you should still use uidInList, but slightly different
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\SplitProcessor
10 {
if.isTrue.field = tx_mask_sectionmenu_contentitems
delimiter = ,
fieldName = tx_mask_sectionmenu_contentitems
removeEmptyEntries = 1
filterIntegers = 0
filterUnique = 1
as = items
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
table = tt_content
uidInList.field = current
as = contentItem
}
}
}
}
To get the actual field name for "current" you might want to put <f:debug>{items}</f:debug> into your Fluid template. Maybe it has to be data = current instead, if the actual behaviour of current is available in this context.
I want to use the field "header_link" for a link around a content element. This is my Typoscript:
temp.teaserblockContent = CONTENT
temp.teaserblockContent{
table = tt_content
select {
pidInList = this
orderBy = sorting
where = colPos = 4
}
renderObj < tt_content
renderObj.stdWrap.typolink {
parameter = {field:header_link}
parameter.insertData = 1
}
}
If I replace {field:header_link} with {tsfe:id} it works. But not with {field:header_link}, even {field:uid} is empty. In database, header_link is set correctly.
How can I access the field values?
tt_content uses gridelements, so a simple 20 = TEXT is not possible.
tt_content.gridelements_pi1.20.10.setup {
1 < lib.gridelements.defaultGridSetup
1 {
columns {
10 < .default
10.wrap = <div class="col-md-12">|</div>
}
}
2 < lib.gridelements.defaultGridSetup
2 {...}
}
Have you tried
parameter.field = header_link
or
parameter.data = field:header_link
EDIT: Try to add header_link to select.selectFields = header_link ... but I think by default if selectFields is not set, every field should be selected.
I tested your typoscript setup and it works. Maybe it would help if you tell us the used TYPO3 version and what all this has to do with gridelements.
I need to show author details on a page.
Here is my typoscript to get the cruser_id of the page content:
20 = CONTENT
20{
table = tt_content
select{
selectFields = cruser_id
}
renderObj = COA
renderObj{
10 = TEXT
10{
required=1
field=cruser_id
}
}
}
How to get the username associated with the cruser_id?
As you didn't specify the context of your code, here's an example that just extends the code you provided.
20 = CONTENT
20 {
table = tt_content
select {
selectFields = cruser_id
}
renderObj = RECORDS
renderObj {
source.field = cruser_id
tables = be_users
dontCheckPid = 1
conf.be_users = TEXT
conf.be_users {
field = username
noTrimWrap = || |
}
}
}
EXPLANATION: You are fetching the content using the CONTENT cObject and telling TYPO3 to render it as RECORDS cObject. This object now has user's UID available as cruser_id and can use it in its configuration using the source.field. RECORDS thus loads the record (with UID = cruser_id) from the be_users table and you tell TYPO3 to render it as a TEXT cObject. As it can be any cObject (e.g. COA), the output can be more complex, including other fields from the backend user's record.
More complex example
20 = CONTENT
20 {
table = tt_content
select {
selectFields = cruser_id, tstamp
}
renderObj = COA
renderObj {
10 = TEXT
10 {
field = tstamp
date = j/n/Y
noTrimWrap = |Last modified: ||
}
20 = RECORDS
20 {
source.field = cruser_id
tables = be_users
dontCheckPid = 1
conf.be_users = COA
conf.be_users {
stdWrap.noTrimWrap = |<br />Author: ||
10 = TEXT
10 {
field = realName
}
20 = TEXT
20 {
field = username
noTrimWrap = | (|)|
}
}
}
}
}