Search code examples
templatestypo3typoscriptfluid

TYPO3 Gridelements w/DataProcessing and FLUID no content


I used Gridelements a while now. I used the following code:

TypoScript (Gridelements (deprecated) (gridelements)):

tt_content.gridelements_pi1.20.10.setup {
  2col < lib.gridelements.defaultGridSetup
  2col.cObject = FLUIDTEMPLATE
  2col.cObject.file = {$resDir}/Private/Partials/Gridelements/2spalten.html
}

FLUID Template:

<div class="row">
    <div class="col-md-6">
        {data.tx_gridelements_view_column_0}
    </div>
    <div class="col-md-6">
        {data.tx_gridelements_view_column_1}
    </div>
</div>

PageTS:

tx_gridelements.setup {
    2col {
        title = Two Columns
        config {
            colCount = 2
            rowCount = 1
            rows {
                1 {
                    columns {
                    1 {
                        name = Links
                        colPos = 0
                    }
                    2 {
                        name = Rechts
                        colPos = 1
                    }
                    }
                }
            }
        }
    }
}

But now I want to use "Gridelements w/DataProcessing (recommended) (gridelements)" because the other one is deprecated. But all I see is the error:

Tried resolving a template file for controller action "Standard->2col" in format ".html", but none of the paths contained the expected template file (Standard/2col.html). The following paths were checked: /var/www/html/typo3/sysext/fluid_styled_content/Resources/Private/Templates/, /var/www/html/typo3/typo3conf/ext/gridelements/Resources/Private/Templates/, /var/www/html/typo3/typo3conf/ext/dev_layout/Resources/Private/Templates/

If I write this in my TypoScript code:

lib.gridelements.defaultGridSetup =< lib.contentElement
lib.gridelements.defaultGridSetup {
    templateRootPaths {
        20 = {$resDir}/Private/Templates/Gridelements/
    }
}
tt_content.gridelements_pi1 < lib.gridelements.defaultGridSetup
tt_content.gridelements_view < tt_content.gridelements_pi1

And when I create the named file, the error no longer appears. But there is no output. I see the divs but no content. How can I switch from deprecated gridelements to dataprocessing gridelements?


Solution

  • I found the solution:

    Template:

    <html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
    <div class="row">
        <f:if condition="{children}">
            <f:for each="{children.1}" as="column" key="columnNumber">
                <div id="c{data.uid}-{columnNumber}" class="grid-column grid-column-{columnNumber} col-lg-6">
                    <f:for each="{column}" as="child">
                        <f:render partial="Child"
                            arguments="{data: child.data, children: child.children, options: options, settings: settings}" />
                    </f:for>
                </div>
            </f:for>
        </f:if>
    </div>
    </html>
    

    For two different cols

    <div id="c{data.uid}-{columnNumber}" class="grid-column grid-column-{columnNumber} {f:if(condition: '{columnNumber} == 0', then: 'col-lg-3', else: 'col-lg-9')}">
                  
    

    My column numbers are left 0 and right 1

    TS in dataprocessing.10:

    2col {
      as = children
        options {
          resolveChildFlexFormData = 0
        }
      }
    }
    

    The documentation is wrong you need this

    tt_content.gridelements_pi1 =< lib.contentElement
    

    TSconfig: Default gridelements TSConfig