FLUIDTEMPLATE Section ... does not exist

Viewed 577

I am using TYPO3 9.5.20
I try to test a FLUIDTEMPLATE implementation and I get an Oops, ... with Section "PageHeader" does not exist.

Here my template file:

    <f:layout name="Layout1ColumnPage" />
    
    <f:section name="WholeContent">
       <div id="whole-content">

          <f:format.raw>{contentNormal}</f:format.raw>
           <f:format.raw>{contentLeft}</f:format.raw>
          <f:format.raw>{contentRight}</f:format.raw>
      </div>
    </f:section>
    
    <f:section name="MainContent">
       <div id="main-content">
          <f:format.raw>{contentLeft}</f:format.raw>
       </div>
    </f:section>
    
    <f:section name="SideContent">
       <div id="side-content">
          <f:format.raw>{contentRight}</f:format.raw>
       </div>
    </f:section>
    
    <f:section name="PageHeader">
        <div id="page-header">
            <div class = "body" cellpadding="0" cellspacing="0">
                <div class = "header w200">
                    <div class = "headTD">
                        <f:image src = "fileadmin/Page/Resources/Public/Images/Country-Radio-2020.jpg"  alt="HeaderImage" />
                    </div>
                </div>
                --- Ende Image ---
            </div>   
        </div>
    </f:section>
    
    <f:section name="PageFooter">
       <div id="page-footer">
          <div id="footer-notice"> <p>This is the page footer area.</p> </div>
       </div>
    </f:section>

Here my layout file

    <div id="page">
       <f:render section="PageHeader" />
       <div id="page-body">
          <div id="page-title">{data.title}</div>
          <f:render section="WholeContent" />
          <div id="page-body-end">&nbsp;</div>
       </div>
       <f:render section="PageFooter" />
    </div>

Here my setup file:

page = PAGE 
page.typeNum = 0
page.10 = FLUIDTEMPLATE 
page.10 {
    format = html
    # Pfad zu der HTML Vorlage der Webseite 
    // file = fileadmin/Page/Resources/Private/Templates/CRtemplate.html
    templateName = CRtemplate
    # Pfad zu eingebundenen Partials 
    partialRootPaths.1 = fileadmin/Page/Resources/Private/Partials/
    # Pfad zur Layout Datei 
    layoutRootPaths.1 = fileadmin/Page/Resources/Private/Layouts/
    # Pfad zur Layout Datei 
    templateRootPaths.1 = fileadmin/Page/Resources/Private/Templates/    
    file.cObject = CASE
    file.cObject {
        key {
            data = levelfield: -1, backend_layout_next_level, slide
            override.field = TSFE:page|backend_layout
        }
        # Einbindung des ersten HTML Templates 
        1 = TEXT
        1.value = fileadmin/Page/Resources/Private/Layouts/Layout1ColumnPage.html
          
        # Einbindung des zweiten HTML Templates 
        2 = TEXT
        2.value = fileadmin/Page/Resources/Private/Layouts/Layout2ColumnPage.html
    }
    variables {
        # Verknüpfung der Inhalte mit dem Backend Layout 
        contentNormal < styles.content.get
        contentNormal.select.where = colPos = 10
        contentLeft < styles.content.get
        contentLeft.select.where = colPos = 11
        contentRight < styles.content.get
        contentRight.select.where = colPos = 12     
    }
}

In my opinion sections are defined in the right way. If I delete in the layout file render of PageHeader then I got the message that he cannot find section WholeContent. So it seems to be a general problem.

EDIT

As Bernd mentioned below, in Typo3 9.5.20 the setting of the rootPath is only possible as an area. example

templateRootPaths.1 = fileadmin/Page/Resources/Private/Templates/  

But the 9.5 documentation still says, that both is possible!

Have also edited the above code!

1 Answers

I can't make out an error for sure, but there are some aspects you might consider for your templating:

  • Your templates miss an header with namespace declartions like
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
      xmlns:n="http://typo3.org/ns/GeorgRinger/News/ViewHelpers"
      data-namespace-typo3-fluid="true">
:
</html>
  • You only define one path. That was usual in the beginning of fluid and replaced with paths arrays. (I don't know whether this still works with single path declarations)
         # Pfad zur Layout Datei 
         templateRootPaths.1 = fileadmin/Page/Resources/Private/Templates/   
         # Pfad zu eingebundenen Partials 
         partialRootPaths.1 = fileadmin/Page/Resources/Private/Partials/
         # Pfad zur Layout Datei 
         layoutRootPaths.1 = fileadmin/Page/Resources/Private/Layouts/
  • your template declaration is weird:
    • first you avoid a declaration of file by commenting
    • then you define a template by templateName
    • which is asided with a file.cObject where you miss that backend layouts might be declared in pageTS and are no longer just numbers (no default value in case)

Meanwhile you can get the evaluation of backend_layout and backend_layout_next_level with the core defined typoscript data pagelayout which results in the simple declaration:

page.10 {
    templateName {
        data = pagelayout
        ifEmpty = default
    }
}

You might add a special fluid variable to debug the values in the backend_layout fields:

page.10 {
    variables {
        pagelayout = TEXT
        pagelayout.data = pagelayout
    }
}

minor topics:

  • Don't store your templates in fileadmin/. Use a site extension.
  • {variable->f:format.raw()} is shorter and most times more readable than <f:format.raw>{variable}</f:format.raw>
Related