Раздел FLUIDTEMPLATE не существует

Я использую TYPO3 9.5.20
Я пытаюсь протестировать реализацию FLUIDTEMPLATE и получаю Oops, ... с Section "PageHeader" does not exist.

Вот мой файл шаблона:

    <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>

Вот мой файл макета

    <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>

Вот мой установочный файл:

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     
    }
}

На мой взгляд разделы определены правильно. Если я удалю в файле макета рендер PageHeader, то я получу сообщение, что он не может найти раздел WholeContent. Так что, похоже, это общая проблема.

ИЗМЕНИТЬ

Как упомянул Бернд ниже, в Typo3 9.5.20 установка rootPath возможна только как область. пример

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

Но документация 9.5 по-прежнему говорит, что оба варианта возможны!

Также отредактировали приведенный выше код!


person HGA    schedule 05.11.2020    source источник
comment
пожалуйста, отредактируйте свой вопрос и добавьте имена файлов (включая пути из веб-корня)   -  person Bernd Wilke πφ    schedule 06.11.2020


Ответы (1)


Я не могу точно определить ошибку, но есть некоторые аспекты, которые вы могли бы рассмотреть при создании шаблона:

  • В ваших шаблонах отсутствует заголовок с объявлениями пространства имен, например
<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>
  • Вы определяете только один путь. Это было обычным явлением в начале флюида и заменено массивами путей. (Я не знаю, работает ли это до сих пор с объявлениями одиночного пути)
         # 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
    • затем вы определяете шаблон с помощью templateName
    • за исключением file.cObject, где вы пропустили, что макеты серверной части могут быть объявлены в pageTS и больше не являются просто числами (в case нет значения по умолчанию)

Тем временем вы можете получить оценку backend_layout и backend_layout_next_level с помощью основных данных типографского текста pagelayout, что приводит к простому объявлению:

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

Вы можете добавить специальную переменную Fluid для отладки значений в полях backend_layout:

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

второстепенные темы:

  • Не храните свои шаблоны в fileadmin/. Используйте расширение сайта.
  • {variable->f:format.raw()} короче и в большинстве случаев читабельнее, чем <f:format.raw>{variable}</f:format.raw>
person Bernd Wilke πφ    schedule 06.11.2020
comment
большое спасибо. Это всегда проблема с примерами Typo3. Он сильно меняется, и иногда вы теряетесь, что по-прежнему актуально, а что нет. - person HGA; 06.11.2020
comment
Насколько я понимаю, в шаблонах должен быть только код между телами. I Но я попробовал HTML-код, но это не помогло. - person HGA; 06.11.2020
comment
В документации 9.5 параметры layoutRootPath и layoutRootPaths по-прежнему действительны. - person HGA; 06.11.2020
comment
И так там также partialRootpath и partialRootPaths нет templateRootPath, только templateRootPaths. - person Bernd Wilke πφ; 06.11.2020
comment
невероятно, в документации Typo3 9.5 есть ошибка, rootPath работает только как область! Спасибо большое! Это заняло у меня несколько дней, чтобы заставить его работать. - person HGA; 06.11.2020
comment
документация также имеет открытый исходный код, как и сам TYPO3. Если вы обнаружите ошибку или считаете, что что-то требует дополнительных пояснений, используйте кнопку Edit on github вверху страницы и создайте запрос на перенос. - person Bernd Wilke πφ; 06.11.2020