0
votes

Im completely new to typoscript therefore I have quite a hard time with the syntax but I think I am getting there.

My task is to render an HTML table and fill it with values from a database table (doesn't matter which one). In my case I took the tt_content table and tried to fill my HTML table with the "header" field and the "bodytext" field.

So I made a completely empty template and wrote the following code in the "setup" field of the template. I added some headers and texts to the sites I have to test my code but I get a completely empty page not even the "table" HTML tags are there.

After 4 days of research I still don't know what my problem is here so I am quite desperate.

Here is what I have so far:

page = PAGE
page.typeNum = 0
lib.object = COA_INT
lib.object {
        10 = TEXT
        10.value = <table>

        20 = CONTENT
        20.wrap = <tr>|</tr>
        20 {
                table = tt_content
                select {
                        orderBy = sorting
                }
                renderObj = COA
                renderObj {
                        10 = COA
                        10 {
                                10 = TEXT
                                10 {
                                        field = header
                                        wrap = <td>|</td>
                                }
                                20 = TEXT
                                20 {
                                        field = bodytext
                                        wrap = <td>|</td>
                                }
                        }
                }
        }
        20 = TEXT
        20.value = </table>
}

If someone could help me out here it would be much appreciated.

Thanks in advance.

1

1 Answers

1
votes

Check if you have any 'template parser' running. go to template -> choose 'Info/modify' and click on 'edit the whole ...' There choose the includes tab and include css_styled_content' (Yes, there is another way of parsing your content, with fluid_styled_content'. you can choose that instead if you are on TYPO3 7.6.* or higher)

These 'parsers' will give you all the needed typoscript included to parse and render your content. Without these, nothing will be rendered when you want to render content from the backend.

second: your typoscript is wrong You have made a content array (lib.content is a Content Object Array) and filled it with content. But you overwrite the content with key 20. change

20 = TEXT
20.value = </table>

to

30 = TEXT
30.value = </table>

third: you have created a Page object but you did not add your COA into that page object.

Try this:

page = PAGE
page.10 < lib.object

What this does is include your lib.content in the Page Object at 'level' 10 you can also do

page.20 = TEXT
page.20.value = hello world

This will be rendered after your lib.content. As you could notice. It is a bit as writing a big Array (because typoscript is a big Array ;)

Beware that you place your lib.content ABOVE the page object declaration. else it will not be able to include it.

There is also a slack channel for TYPO3 you can join if you have other questions. People over there are more then willing to help you. https://forger.typo3.org/slack