2017-04-05 81 views
0

我试图在TYPO3中使用不同的前端布局。所以我使用这种花式的TypoScript:TYPO3中不同的前端布局

page { 
    bodyTag = <body> 

    10= CASE 
    10.key.field=layout 
    # Standardtemplate 
    10.0 = TEMPLATE 
    10.0.template = FILE 
    10.0.template.file = fileadmin/template/content_template.html 
    10.0.workOnSubpart = DOCUMENT_BODY 

    # Variante 1: 
    10.1 = TEMPLATE 
    10.1.template = FILE 
    10.1.template.file = fileadmin/template/index_template.html 
    10.1.workOnSubpart = DOCUMENT_BODY 

    includeJSFooter { 

    jquery = fileadmin/template/js/jquery.js 
    bootstrap = fileadmin/template/js/bootstrap.min.js 
    app = fileadmin/template/js/app.js 

    } 

    includeCSS { 

    robotoFont = https://fonts.googleapis.com/css?family=Roboto:100,400 
    robotoFont.external = 1 
    robotoFont.media = all 

    bootstrapCore = fileadmin/template/css/bootstrap.min.css 
    bootstrapCore.media = all 


    } 
} 

这还没有工作。每一个页面都是完整的。只有一个白页出现。我正在使用TYPO3 7.6.16。上面的代码中是否有任何问题?

回答

0

它认为你正在寻找这只是把它放在PAGE-Element中,并重命名路径,并创建一些在布局1中命名为值的BackendLayouts。希望这有助于:

10 = FLUIDTEMPLATE 
    10 { 
      file = fileadmin/templates/Page/Standard.html 

      partialRootPath = fileadmin/templates/Partials/ 

      variables { 

        layout = CASE 
        layout { 
          key.field = backend_layout 
          key.ifEmpty.data = levelfield:-2, backend_layout_next_level, slide 

          1 = TEXT 
          1.value = startpage 

          2 = TEXT 
          2.value = subpage 

          3 = TEXT 
          3.value = subpagespecial 

          default = TEXT 
          default.value = subpage 
        } 

        content = CONTENT 
        content { 
          table = tt_content 
          select.orderBy = sorting 
          select.where = colPos=0 
          select.languageField = sys_language_uid 
          select.includeRecordsWithoutDefaultTranslation = 1 
        } 

        header = CONTENT 
        header { 
          table = tt_content 
          select.orderBy = sorting 
          select.where = colPos=1 
          select.languageField = sys_language_uid 
          select.includeRecordsWithoutDefaultTranslation = 1 
        } 
        content2 = CONTENT 
        content2 { 
          table = tt_content 
          select.orderBy = sorting 
          select.where = colPos=3 
          select.languageField = sys_language_uid 
          select.includeRecordsWithoutDefaultTranslation = 1 
        } 
        contentfull = CONTENT 
        contentfull { 
          table = tt_content 
          select.orderBy = sorting 
          select.where = colPos=2 
          select.languageField = sys_language_uid 
          select.includeRecordsWithoutDefaultTranslation = 1 
        } 
      } 
    } 
+0

:/ – JonasLoerken

+0

我会推荐它。它易于使用,面向未来,易于维护检查wiki https://wiki.typo3.org/T3Doc/Fluidtemplate_by_example – LittleHoopoe

0

请在CASE对象中添加一个默认的变体。可能是重新创建的页面在其“布局”列中没有“0”。

您是否确认子部分标记拼写正确?

<!-- ###DOCUMENT_BODY### begin --> 
Your HTML template 
<!-- ###DOCUMENT_BODY### end --> 

您可以简化您的TypoScript模板:

page { 
    10 = TEMPLATE 
    10.template = FILE 
    10.template.file = CASE 
    10.template.file { 
     key.field = layout 
     default = TEXT 
     default.value = fileadmin/template/content_template.html 
     1 = TEXT 
     value = fileadmin/template/index_template.html 
    } 
    10.workOnSubpart = DOCUMENT_BODY 
} 
我不使用流体模板