I have a TYPO3 v13.2.1 website and I want to add data from a custom database table into a pages head tag.
Currently I am attempting
page.headerData {
10 = CONTENT
10 {
table = my_custom_table
select {
selectFields = head_content
max = 1
}
renderObj = COA
renderObj {
10 = TEXT
10.value = head_content
}
}
}
page
is of typePAGE
headerData
is of typeCObj
by default and can hold objects of typeCONTENT
- 10 is of type
CONTENT
, where I base my code upon the documentation at https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/ContentObjects/Content/Index.html#cobj-content
I don’t know how to debug it. I can only tell, that the database query gets fired since when I am writing the table or column incorrectly, TYPO3 throws an error.
What am I doing wrong?
EDIT 1:
I checked the Typoscript rendering after applying another test and it looks like this:
I’m not quite sure, but I guess you need to use the record as field data for the renderObj, something similar to following:
page.headerData.10 = CONTENT
page.headerData.10.table = my_custom_table
page.headerData.10.select {
selectFields = head_content
max = 1
}
page.headerData.10.renderObj = COA
page.headerData.10.renderObj.10 = TEXT
page.headerData.10.renderObj.10.stdWrap.field = head_content
page.headerData.10.renderObj.10.stdWrap.wrap = |
Adopted from here https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/ContentObjects/Content/Index.html#apply-special-rendering
Note: You may use another headerData value, for example page.headerData.100 or so – maybe it is overriden later with anouter value ?
1