complex contenelements with typoscript

Complex content elements with typoscript without controller

As you can read in this article, we can create elements very easily and quickly with typoscript and Fluid.

As an example, we will now display the title of the current page in our new element.

tt_content.additional_text =< lib.contentElement
tt_content.additional_text {
    layoutRootPaths.20 = EXT:site_provider/Resources/Private/Layouts/
    partialRootPaths.20 = EXT:site_provider/Resources/Private/Partials/
    templateRootPaths.20 = EXT:site_provider/Resources/Private/Templates/
    template = AdditionalText

    variables {
        pageTitle = CONTENT
        pageTitle {
          table = page
          select {
            pidInList = 0
            uidInList = this
            where.field = pid
            where.wrap = uid=|
          }
          renderObj = TEXT
          renderObj.field = header
        }
    }                         
}
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:layout name="Default" />
<f:section name="Main">
    <f:debug>{_all}</f:debug>

    <f:format.html>{data.bodytext}</f:format.html>

    <h2>{pageTitle}</h2>

</f:section>

</html>

For all those who are now screaming and saying it's much easier with getText. Yes, of course I know that. I deliberately structured the example this way to explain the CONTENT object.

I need this for the next examples.

Comments

No Comments

Write comment

* These fields are required