TYPO3 FLUID空白页TYPO3

时间:2017-05-16 07:13:47

标签: typo3 fluid typo3-7.6.x

我尝试创建我的第一个FLUIDTEMPLATE。但是Methode

  

F:布局

不要激活。

我的结构:

/fileadmin/
/fileadmin/layouts/layout.html
/fileadmin/partials/
/fileadmin/styles/
/fileadmin/templates/template.html
/fileadmin/typoscript/
/fileadmin/typoscript/01_script/setup.ts
/fileadmin/typoscript/02_object/

setup.ts:

page = PAGE
page.typeNum = 0

page.10 = FLUIDTEMPLATE
page.10 {
    format = html
    file = fileadmin/templates/layouts/layout.html
    partialRootPath = fileadmin/templates/partials/
    layoutRootPath = fileadmin/templates/layouts/
    variables {
        content_main < styles.content.get
        content_main.select.where = colPos = 0
    }
}
page.10.file.stdWrap.cObject = CASE
page.10.file.stdWrap.cObject {
    key.data = levelfield:-1, backend_layout_next_level, slide
    key.override.field = backend_layout

    default = TEXT
    default.value = fileadmin/templates/template.html
}

的layout.html:

<div id="wrapper">
      <div id="header">
      header
      </div>

      <div id="top_nav">
      top_nav
      </div>

      <div id="left">
      left
      </div>      

      <div id="right">
      right
      </div>

      <div id="center">
          center
      </div>

      <div id="footer">
       footer
      </div>
</div>

template.html:

<f:layout name = "Layout" />

模板设置:

<INCLUDE_TYPOSCRIPT: source ="DIR:fileadmin/typoscript/">

现在,如果我查看网页,我只看到一个空白页面。如果我查看代码,我得到了:

<!DOCTYPE html>
<html lang="en">
<head>

    <meta charset="utf-8">
    <!-- 
        This website is powered by TYPO3 - inspiring people to share!
        TYPO3 is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.
        TYPO3 is copyright 1998-2017 of Kasper Skaarhoj. Extensions are copyright of their respective owners.
        Information and contribution at https://typo3.org/
    -->



    <title>Fluid</title>
    <meta name="generator" content="TYPO3 CMS">


    <link rel="stylesheet" type="text/css" href="typo3temp/Assets/b9db200ac9.css?1491821607" media="all">

    </head>
    <body>
    <f:layout name = "Layout" />

    </body>
    </html>

我使用的是TYPO3 v7.6.16。

3 个答案:

答案 0 :(得分:2)

模板:Startseite.html

<f:layout name="Default" />

<f:section name="body">
    <div id="wrapper">
        <div id="header">
            {header->f:format.raw()}
        </div>

        <div id="top_nav">
            {top_nav->f:format.raw()}
        </div>

       <div id="left">
            {left->f:format.raw()}
       </div>      

       <div id="right">
            {right->f:format.raw()}
       </div>

       <div id="center">
            {center->f:format.raw()}
       </div>

       <div id="footer">
            {footer->f:format.raw()}
       </div>
   </div>
</f:section>

您可以为内页(Inhaltsseite)布局配置相同的内容。

布局: Default.html

<f:render section="body" />

Typoscript:(setup.ts)

lib.pageTemplate = FLUIDTEMPLATE
lib.pageTemplate {

    templateName = TEXT
    templateName.stdWrap.cObject = CASE
    templateName.stdWrap.cObject { 
        key.field = backend_layout

        # @todo: setup all page templates
        default = TEXT
        default.value = Startseite

        1 = TEXT
        1.value = Inhaltsseite

    }

    templateRootPaths {
        10 = fileadmin/templates/Resources/Private/Templates/
    }    
    partialRootPaths {
        10 = fileadmin/templates/Resources/Private/Partials/
    }
    layoutRootPaths {
        10 = fileadmin/templates/Resources/Private/Layouts/
    }

    variables {
        content = CONTENT
        content {
            table = tt_content
            select.orderBy = sorting
            slide = -1
            select.where = colPos=0
        }
    }
}

# Page setup Configuration
page = PAGE
page {
    # Your TypeNum
    typeNum = 0

    #Include header data if any
    headerData{
    }

    #Include website meta
    meta{
    }

    #Include stylesheet
    includeCSS {
    }

    #Include Js files(In the header)
    includeJS {
    }

    #Include Js in footer
    includeJSFooter {
    }

    # assign template (copy fluid template object)
    10 < lib.pageTemplate
}

在BE中的template-&gt; include-&gt; setup.ts中加入setup.ts。

<INCLUDE_TYPOSCRIPT:source="FILE:fileadmin/templates/Configuration/TypoScript/setup.ts" />

问候!

答案 1 :(得分:2)

您的示例代码存在一些问题。让我们来看看:

  1. 您不应将模板放在fileadmin中(默认情况下)可由Web请求访问,也可由编辑器编辑。而是将它们放在Resources/Private/下的扩展名中。
  2. 您不应将布局文件指定为模板。

    file = fileadmin / templates / layouts / layout.html

  3. 您应该在Resources/Private/Templates

    内指向一个类似Template.html的模板,而不是layout.html
    1. 在您的模板中,您可以包含一个布局文件。但是删除空格:<f:layout name="Layout" />
    2. 为模板,布局和部分文件使用UpperCase名称(Template.html代替template.html)。
    3. 改为使用templateRootPathslayourRootPaths以及partialRootpaths
    4. 所以你的TypoScript看起来像这样:

      page.10 = FLUIDTEMPLATE
      page.10 {
          format = html
          file = EXT:my_ext/Resources/Private/Templates/Template.html
          partialRootPaths {
              10 = EXT:my_ext/Resources/Private/Partials/
          }
          layoutRootPaths {
              10 = EXT:my_ext/Resources/Private/Layouts/
          }
          templateRootPaths
              10 = EXT:my_ext/Resources/Private/Templates/
          }
          variables {
              content_main < styles.content.get
              content_main.select.where = colPos = 0
          }
      }
      

答案 2 :(得分:0)

首先,您必须在打字稿中创建一个页面对象(上面的打字稿中缺少该对象): 页面= PAGE 这应该是您的打字稿的第一行。